-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When applying a Prismatic Joint, the localAxisA is normalized. This causes {NaN, NaN} when the joint is new Vector2(0,0)
See
box2d-netstandard/src/box2dx/Box2D.NetStandard/Dynamics/Joints/Prismatic/PrismaticJoint.cs
Line 146 in b34d623
| m_localXAxisA = Vector2.Normalize(def.localAxisA); |
How To Reproduce
Create a new prismatic joint where the localAxisA is new Vector2(0,0)
You can work around the issue by using Reflection to update the private values:
var jdef = new PrismaticJointDef();
jdef.bodyA = body1;
jdef.bodyB = body2;
jdef.collideConnected = false;
jdef.localAxisA = new Vector2(0, 0);
var pJoint = world.CreateJoint(jdef);
var propX = pJoint.GetType().GetField("m_localXAxisA", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var propY = pJoint.GetType().GetField("m_localYAxisA", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
propX.SetValue(pJoint, new Vector2(0, 0));
propY.SetValue(pJoint, new Vector2(0, 0));Expected Behavior
Something similar to:
HughPH
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working