x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Make character swing from grappling hook

Currently working on a 3D third person game where the character shoots out a ray cast to an object and creates a rope looking arm. The end goal is to have 2 options: if the object is an enemy, pull it to the character; otherwise, if the object is part of the map, the hand of the arm should stick to the object and allow you to apply impulse to the character to swing in any direction while also controlling the length of the arm (being able to lengthen and shorten the arm).

I've done some reading and we have the arm attach to the object but I'm not sure how to apply constraints to keep the arm a certain max length. Any help appreciated

Product Version: UE 4.10
Tags:
more ▼

asked Jan 07 '16 at 01:31 AM in Blueprint Scripting

avatar image

ambid17
1 1 2 3

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You basically have two options.

  1. Have a physically based simulation of a rope (this might also simply a straight line rather than an actual rope). In this case you would have another object / actor attached to the two locations and force them to stay at that max distance. (I have no idea how to actually do that).

  2. Cheat by simply projecting the velocity on a plane, and then moving the character to max distance if it's further away than max distance.

The second thing I actually have done. There is some issues with it, especially if you jump pretty much straight down. Nothing unfixable but it's a bunch of work to get right.

What you do is you take the point you grappled to subtract your current location from that, normalize it to a vector length of one (not sure if that's necessary but that's what my script does. Easily done by dividing the vector by the "VectorLength"). Get the node "Project Vector on to Plane". The V for that node is your Character Velocity. The Plane Normal is the vector we just created. Set that as new velocity. Calculate the point along your rope path that is your "MaxLength" and set your actor location to there. Why is that necessary? Because projecting the velocity to a plane means you always take the current plane and moves you forward on it and in case you are swinging will each tick put you slightly further away from the intended result. Because you technically would want to project your movement along a sphere. Not a plane.

It's a real dirty hack. Maybe it helps you. Probably not.

Just wanted to throw it out there anyway ;)

Cheers

more ▼

answered Jan 07 '16 at 04:32 PM

avatar image

Erasio
5.9k 291 86 293

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question