Question by
Rhave · Apr 11, 2016 at 01:10 PM ·
rigidbodyprogrammingcollision detectionhitbox
How to use collision detection properly?
So I am a pretty noob programmer and just started trying some things. I've managed to create a box that moves thanks to android's sensor and the point is that based on the velocity the object's hitbox "crosses" the limit.
Along with other stuff I use this for movement:
transform.Translate (speed * x * 100 * Time.deltaTime, 0, 0);
And then I use OnCollisionEnter and OnCollisionExit to detect if the box has collided with the wall.
The program works just fine but the problem is that visually this is what happens when it impacts "fast":
And "slow":
And I obviously want it to stop when it hits the "first pixel".
I don't know if it has something to do with my programm or is it the hitbox of the object. Any advice?
fd6d063f2982913da4f0f93581c6ba15.png
(11.7 kB)
6494e691d61d8dc082d959ac25f9c4d5.png
(11.7 kB)
Comment