- Home /
Question by
$$anonymous$$ · Aug 17, 2015 at 08:27 PM ·
unity 5localglobalconstraints
Rigidbody Constraints not work in local space(Unity 5)
Hey guys! I need to constraint the movement of a character in Z axes, but i have to constraint this only in LOCAL space not in GLOBAL space. Is there a way to do this?
Tnx Dude :D
Comment
How about? :
float lockPos = 0f;
void Update()
{
transform.localPosition = new Vector3(0, 0, lockPos);
}
with the code above it won't move at all, try
float lockPos = 0f;
void Update()
{
transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, lockPos);
}