- Home /
How to preserve momentum with DistanceJoint2D
I've been playing around with making a 2D co-op game and I wanted players to be able to "grab" each other.
My current problem is that momentum seems to be lost after a joint is created.
For example, say I have one character really high up (A) and another character (B) down below on a small ledge. Ideally the high up character could jump down, grab the other character on the way down (creating a DistanceJoint2D between the characters), pivot around the character, and be slingshotted back up using their own momentum (the joint is destroyed when the character presses the jump button after the pivot).
The illustration below is supposed to show what I'm talking about.
Unfortunately, character A seems to lose all momentum when the joint is created. (The momentum is lost before making any rotation around character B). Is there another way to go about this to prevent that from happening?
A
|...........|
|...........|
|....B....|
\\ ......../
..\...../
....\\/
Answer by jacobhanshaw · Nov 28, 2013 at 05:22 PM
Turned out my problem was due to something else.
I used some code from the example Unity 2D project and it slowed me down due to a max x velocity limit.
Your answer
Follow this Question
Related Questions
Continuously moving rigidbody 2 Answers
Lifting box 2D C# 0 Answers
2d grounded check problem? 3 Answers
Question about Physics2D.Linecast 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers