behdad / box2d

Automatically exported from code.google.com/p/box2d
2 stars 12 forks source link

Prismatic joint jumps/drifts/stutters when directionOfMove is diagonal. #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I have a peculiar problem with the prismatic joint. It works great as long as I 
am not trying to 
move in a diagonal direction. When I set it to move diagonally (1, 1), it 
constantly jumps(driifts) a 
little bit. If the motor is on, it will reach it's limit and then keep trying 
to move (like bouncing a 
tiny bit). If the motor is set to 0.0f it will jump around in tiny increments 
at it's setup location.

The behaviour is reproducable in the Testbed, in the Prismatic example if the 
following change is 
made:
Code:
pjd.Initialize(ground, body, b2Vec2(0.0f, 0.0f), b2Vec2(1.0f, 1.0f)); 

Even more strange is the behaviour if I set the motor speed to 0.0f:
Code:
pjd.motorSpeed = 0.0f;

and use a mousejoint to grab and move the platform it starts stuttering and 
jumping very 
erratically. I tried the bouncy and non-bouncy limits during joint initialize 
and get the same 
results.

Any ideas on how I can get the stability of movement at the limits that I see 
when 
DirectionOfMovement is set to vertical or horizontal ?

What is the expected output? What do you see instead?
The joint should sit still at upper and lower limits like it does when the 
direction movement is 
perfectly vertical or horizontal.  But it does not, it keeps drifting.  
Also, it should not jump erratically when grabbed with the a mouse joint and 
moved.

What version of the product are you using? On what operating system?
Version bundled with Cocos2d v0.9 alpha.

Please provide any additional information below.
Per Erin Catto, I am opening this bug report.
See post: http://www.box2d.org/forum/viewtopic.php?f=3&t=4332

Original issue reported on code.google.com by Tralorni...@gmail.com on 24 Jan 2010 at 2:25

GoogleCodeExporter commented 9 years ago
First, use a unit vector for the axis. Use b2Vec::Normalize.
Second, use more iterations.
Third, place the anchors and axis so the axis runs through the center of mass 
of the 
attached bodies.

Please re-open this issue if you still have a problem.

Original comment by erinca...@gmail.com on 2 Feb 2010 at 8:08