- Home /
Question by
InSpirationhh · Aug 30, 2020 at 09:29 PM ·
direction2d-physicstopdownrigidbody-collision
Aiming direction altered after collision
error2.jpg
(167.9 kB)
error1.jpg
(175.7 kB)
Comment
Answer by InSpirationhh · Aug 30, 2020 at 09:31 PM
Hello! I've been working on a top down shooter game recently and I've run into a weird issue. So I used a vector2 variable to calculate the direction my character should look at (mouse position - rigidbody2d.position), and everything works fine until my character collides with something. After the collision, there's an offset between my mouse position and where my character looks at and shoot, as illustrated by the images below. I'm suspecting that it has something to do with rigidbody but I'm not sure how to solve it. Any help is greatly appreciated! (Not sure why the description disappeared but here's my question. Thank you!)