The locking part has and I do know the answer to that....Using a configurable joint and setting x,y,z motion and/or angularmotion to Locked or scripting to z=0 in the update.
This works for the most part but I've found that when I drag my player object across a ground plane with a collider, that the Z-axis (for me) shifts ever so slighty, so a value set to 1000 will end up at 1003. This is enough to send my player off the boundaries of my game plane.
Does anyone know how to constrain it to a value and if the value ends up slightly off it is automagically reset to 1000.
asked Aug 05 '10 at 04:09 PM
Use this code (untested js):
or (again, untested js):
The first code constantly sets z to 1000. The second code constantly sets z to the height of your ground, whatever that may be. Pick the one you need.
answered Aug 05 '10 at 04:54 PM
you should do z=0 in LateUpdate().
answered Aug 05 '10 at 04:18 PM