Collision check between 2 dynamic objects

Blitz3D Forums/Blitz3D Programming/Collision check between 2 dynamic objects

Mortiis(Posted 2009) [#1]
I have 2 dynamic objects, one is the camera pivot and other one is a mesh.

When the mesh is not moving, camera collides with it just fine but as soon as the mesh starts to move, the collision check start to fail depending on the rotation the collusion happens.

mesh -> <- camera (if they collide while moving like this it fails)
camera -> -> mesh (while like this one, it' works ok)

I'm using ellipsoid to polygon collisions. How can I fix this issue, do I need a third party library like nuclear glory collision?


puki(Posted 2009) [#2]
Collisions have always been a git - which is why some people use EntityDistance under certain circumstances.

I never use ellipsoid collisions - however, make sure you have set collision radiuses.


Mortiis(Posted 2009) [#3]
Thanks, the radius of the source object is already set...any other suggestions?


Noobody(Posted 2009) [#4]
Unfortunately, the B3D collision doesn't work if both entities are moving.
You could surround the camera with a cube and check collision with MeshesIntersect, but that would only take care of the collision detection, the collision response woul be up to you.


Stevie G(Posted 2009) [#5]
There is a native dynamic collision library in the code archives by simonh. It may be of use here :

http://www.blitzbasic.com/codearcs/codearcs.php?code=898


Mortiis(Posted 2009) [#6]
Thanks boyz, what if I buy nuclear glory collision, would that be a solution to all my collision sided problems?


jfk EO-11110(Posted 2009) [#7]
Not sure of that, but there are some further options:

Not sure if you already do this: use the same EntityType for source and target n the Collisions Declaration. And as somebody said, if the collision is sphere vs sphere then EntityDistance is a much faster way to do a collision check.

Finally, if you want dynamic collision, then you may add an UpdateWorld(0) after moving object A, and then call the original updateworld(n) after moving object B.


Adam Novagen(Posted 2009) [#8]
I had some trouble with collisions myself recently; I had to use Collisions() both ways for it to work, so something like:

Collisions Entity_Col,Camera_Col,1,2
Collisions Camera_Col,Entity_Col,1,2

After that it worked. O_o


Mortiis(Posted 2009) [#9]
Not sure if you already do this: use the same EntityType for source and target n the Collisions Declaration. And as somebody said, if the collision is sphere vs sphere then EntityDistance is a much faster way to do a collision check.


If I use the same EntityType for both source and the target they wouldn't collide each other, but I have to try it. It's not sphere to sphere but sphere to poly collision and while EntityDistance is good for collecting stuff for a platformer game, it won't work in my situation because I want my object to collide and stop on a moving mesh.

I had some trouble with collisions myself recently; I had to use Collisions() both ways for it to work, so something like:


Already tried that, not working sadly :(


Ross C(Posted 2009) [#10]
Move one mesh, updateworld, move the second mesh, update world. That will work fine, because your only moving one mesh at a time.

Be sure to disable any unneeded collisions for the first updateworld, as it will increase your loop time.


jfk EO-11110(Posted 2009) [#11]
What Ross said. And you may have to use updateword(0) for additional updateworlds.


Mortiis(Posted 2009) [#12]
That works great thanks!