How do I restrict movement on an axis depending on the position of my character?
I'm a student and this is the first year I'm learning how to program. In this specific level I have a character that can move on x and y axis on the first floor, but then when he enters each door he is supposed to move either only on x OR y axis. Each door also has triggers I used to do the teleport thing. I tried to do this but with OnTriggerEnter but then it would only work when he was inside the trigger. Any tips?
Answer by frilanski · Jun 04, 2021 at 09:32 PM
Assuming you're using a Rigidbody component, there is a Constraints part where you can restrict what axis physics can affect the object in. You should be able to toggle these from code. Hope this helps.
Your answer
Follow this Question
Related Questions
Movement acceleration 1 Answer
Make the Player unable to move to opposite direction 1 Answer
My controls are wierd 0 Answers
Object don't move towards. 0 Answers
How can I state the movement speed of this script? 0 Answers