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
asked Jan 07 '16 at 01:31 AM in Blueprint Scripting
You basically have two options.
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 ;)
answered Jan 07 '16 at 04:32 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here