Unity Help
I am just messing around with unity trying to see what different code does, but i cant figure out why on trigger enter is not working
4 Replies
player settings
Wall (what i am having the player collide with) settings
I corrected it to OnTriggerEnter and it still doesn't work btw
Do either a Debug.Log("test"); inside of the OnTriggerEnter method or set a breakpoint
to make sure it doesn't trigger
Also your function in OnTriggerEnter will only be called once when the trigger has been entered
so all it will do is rotate once by a very tiny amount
Do the rotation logic in Update based on the state of a boolean such as
shouldRotate
which you set to true in OnTriggerEnter and set it to false in OnTriggerExit
Oh, and avoid using transform.translate or setting the position of the transform manually because that means it will teleport and it will not check for collisions between previous position and new position which in turn can make you go through walls.
Let Rigidbody handle it by using it's velocity