29-08-2022, 05:43 PM
(29-08-2022, 04:24 PM)shaylavi Wrote: Im shooting a rigidbody that a rope is attached to and making it longer cursor.ChangeLength() until it reaches a wall.
When it does I "lock" the length and then the player (which is attached to the other side of the rope) gets a massive velocity change towards the shot rigidbody.
Anyway to cancel out this velocity?
Hi!
Well, this depends on a lot of things:
- Where's the cursor placed along the rope?
- Are you setting the length instantly (in a single frame) or over multiple frames?
- What's the mass of the rope compared to the mass of the player?
If your rope is heavy compared to the player and the length is changes in a single frame, then the player will be catapulted towards the shot rigidbody, this is the expected behavior. Imagine launching a projectile to which you're attached via a heavy chain, the combined inertia of the chain + the projectile would pull from you.
You can check out the included RopeGrapplingHook sample scene for an example of how to implement a grappling hook.
kind regards,