Very simple collision detection?

Started by
11 comments, last by Xnin 21 years ago
your diagrm show the pretty easy effect.

if the wall is stright to your angle (should not effect the angle itself) it should not have any problem :



------------
/ / /
so for this example let issume the ball is moving on the z axi and on the x axi.

if you checked the collision and find out that the ball hit the wall because you increase the Z. you should invert the Z speed (for example -ZSpeed)

if you checked the collision and find out the ball hit the wall because you increase the X. you should invert the X speed.

the more complicated collision is :

/| / | / | |

this is the same idea as yours but this time the wall is angeld.

so the speed of the X should be reduced by the angle of the wall.
this time you should know what angle is your wall.

It isnt so hard to implement , but this is just the begining

B00Zagl0

[edited by - B00Zagl0 on April 2, 2003 8:11:40 AM]
Advertisement
quote: you should know what angle is your wall.


Thats what the normal vector is for. James put it in his example .
quote:Original post by B00Zagl0
your diagrm show the pretty easy effect.

if the wall is stright to your angle (should not effect the angle itself) it should not have any problem :



------------
/ / /
so for this example let issume the ball is moving on the z axi and on the x axi.

if you checked the collision and find out that the ball hit the wall because you increase the Z. you should invert the Z speed (for example -ZSpeed)

if you checked the collision and find out the ball hit the wall because you increase the X. you should invert the X speed.

the more complicated collision is :

/| / | / | |

this is the same idea as yours but this time the wall is angeld.

so the speed of the X should be reduced by the angle of the wall.
this time you should know what angle is your wall.

It isnt so hard to implement , but this is just the begining

B00Zagl0

[edited by - B00Zagl0 on April 2, 2003 8:11:40 AM]


Hehe, yes...
And just for the hell of it, why not add momentum, to get the right speed at which the ball rebounds of the wall... Hehe, try and make it even more complicated...

This topic is closed to new replies.

Advertisement