Lock an entity to a plane
Posted: Mon May 04, 2015 11:02 pm
I'm trying to lock certain entities into a 2D environment
doesn't seem to work, as the entity keeps falling off the plane of existence. I also question why a theoretically 1-body'd joint would take two bodies as input, which heavily implies I'm doing this wrong. What's the proper way to do this?
Note: An ideal solution would keep the center of the entity ( (0,0,0) relative to the entity) perfectly along the plane... in this case, ensuring z always == 0, no matter what happens.
Code: Select all
TheClient.PhysicsWorld.Add(Body);
popj = new PointOnPlaneJoint(Body, Body, new Vector3(0, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 0, 0));
TheClient.PhysicsWorld.Add(popj);
raj = new RevoluteAngularJoint(Body, Body, new Vector3(0, 0, 1));
TheClient.PhysicsWorld.Add(raj);
Note: An ideal solution would keep the center of the entity ( (0,0,0) relative to the entity) perfectly along the plane... in this case, ensuring z always == 0, no matter what happens.