Question by
TomLuther · Jun 28, 2017 at 06:20 PM ·
rigidbody2dcollision detectiononcollisionenterrigidbody.velocity
OnCollision2D not accessing rigidbody velocity
im trying to make an enemy change direction each time it hits a wall. I don't know why the oncollisionenter2d function can't change this. The debug message it printed but I cant find away of inversing the velocity. It seems to work if I put the code in the update function (object changes direction each frame) Any help appreciated, thank you.
41ba120378a712d351d9e4da55b4eb82.png
(19.8 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612125058im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Does the parent Rigidbody compensate for children? 0 Answers
Object Colliding while passing along another object . 0 Answers
Projectile Changing Angle BEFORE Impact 0 Answers
OnCollisionEnter Problem 1 Answer