whats up ?
Is there a way to lock an object to a specific transform via script ? I’ve got a game object thats ment to travel across an the x axis but because off the rotation (which i cant seem to fix either) it always travels a bit to the right . Could I lock the z axis from a script . I’ve already put a restraint on it through a rigidbody but it moves anyway ?
Help appreciated (and needed)
Thanks !
Go to inspector and find the unlocked lock in the transforms. click on it to lock the transforms of the object. I do not believe you can do this in a script.
don’t understand much your needs but a rude aproach could be to grab the z location into a variable while in the start function of an script attached to your object and then in the update function always set the z location to this value. Anyway this will cause weird outputs if there’s something changing this z value, my suggestion is to find it instead of forcing the z location of your object
You can add a component called position restraint as of unity 2019!