C
C#2d ago
Austin9675

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
No description
4 Replies
Austin9675
Austin9675OP2d ago
player settings
No description
Austin9675
Austin9675OP2d ago
Wall (what i am having the player collide with) settings
No description
Austin9675
Austin9675OP2d ago
I corrected it to OnTriggerEnter and it still doesn't work btw
Buddy
Buddy2d ago
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

Did you find this page helpful?