- Home /
Move towards connected body
Hello, I have made a simple thing where the character can latch on to an object and acts like they are swinging from a grappling-hook. I use a confrigurable joint on an object at to point at which the "grapple" would be and that is connected to the player, allowing to player to swing, ect. I would like to know if there is away to move the player along its Y-axis (the Y axis always faces the "grapple") like they are reeling in themselves to the "grapple". Would I have to disable the rigidbody and configurable joint and lerp the player to the grapple or could I do it while the player still has the ability to swing using physics (I prefer the latter)?
Answer by MaGuSware™ · Dec 23, 2012 at 11:02 AM
If the players Y is always facing the grapple, then you can use the player objects transform.up to get the direction as a unit vector. Apply a force or set the velocity of the rigid body in that direction when the control to reel in is applied, as it is swinging you will need to get the transform.up every update.
Tried adding a force to the rigidbody's local Y, nothing happens. Setting its velocity doesn't move the player along its Y. I think it's because of the configurable joint I use to swing. It won't allow me to move the player closer to the grapple while it's active, but by setting the limit, I can move the player away.
Your answer
Follow this Question
Related Questions
Hooking RigidBody.AddForce 0 Answers
Keep a certain distance between two RigidBodies 2 Answers
3D Grappling Hook? 0 Answers
Grappling Hook? 1 Answer
Need Help Getting Rope To Wrap/Straighten In 3D Space 0 Answers