ShiVa3D
Dynamics Collider for Disc
All about the StoneScriptDynamics Collider for Disc
by SharpShooter » 20 Nov 2011, 09:47
Hi All,
I am new to Shiva3D and I must say that I am really impressed with the engine.
I am trying to create something like Air Hockey. I could get the basic physics to work, but if I use the box collider for the discs, the collisions are really bad. I would like to know whats the best way to set a collider to a disc or a cylinder.
Thanks.
I am new to Shiva3D and I must say that I am really impressed with the engine.
I am trying to create something like Air Hockey. I could get the basic physics to work, but if I use the box collider for the discs, the collisions are really bad. I would like to know whats the best way to set a collider to a disc or a cylinder.
Thanks.
- SharpShooter
- Fresh Boarder

- Posts: 1
Re: Dynamics Collider for Disc
by broozar » 20 Nov 2011, 22:52
compound physics object composed of 5 boxes. maybe this video helps: http://www.youtube.com/watch?v=81r-1E-hwEY&feature=channel_video_title
Re: Dynamics Collider for Disc
by rusty » 21 Nov 2011, 13:36
I have no evidence for this, but when i've imported complex models (concave, etc) the collisions have seemed to work fine even though there are no settings for triangle meshes and convex hulls.
Taking a quick look at the ODE docs, it does handle both...
http://opende.sourceforge.net/wiki/index.php/Manual_%28All%29#Convex_Class
If you go up a little, it also handles capsules and cylinders too. I don't know how ShiVa works internally but it should have the capability even though the GUI doesn't reflect it.
Taking a quick look at the ODE docs, it does handle both...
http://opende.sourceforge.net/wiki/index.php/Manual_%28All%29#Convex_Class
If you go up a little, it also handles capsules and cylinders too. I don't know how ShiVa works internally but it should have the capability even though the GUI doesn't reflect it.
- rusty
- Expert Boarder

- Posts: 97
Re: Dynamics Collider for Disc
by Fraser » 16 Mar 2012, 23:38
This could be done with your own AI physics:
pseudocode for puck with puck collision:
An alternative and easier method (although maybe more CPU) would be to use shiva physics with spherical dynamic bounding bodies for the pucks, centred about the pucks centre, same radius as the pucks. Then lock the angular rotation for X and Z using
dynamics.setAngularDampingEx ( hPuck, 1000000, 0, 1000000 )
if the above does not lock hard enough or it "creeps" then instead use this in each enterframe:
object.setRotation( hPuck, 0, 0, 0, object.kGlobalSpace)
Of course this spherical bounding body would cause the visible pucks to levitate over the table, so you would need to place the visible table (without collider) above an invisible collider object underneath.
pseudocode for puck with puck collision:
- Code: Select all
x1,y1,z1 = gettranslation(puck1)
x2,y2,z2 = gettranslation(puck2)
d1 = x2-x1
d2 = z2-z1
d = sqrt(d1*d1 + d2*d2)
r2 = radius_of_pucks * 2
if(d < r2)
then
COLLIDED:
collision point on puck edges is obtained with math.ATAN2(d1,d2)
end
An alternative and easier method (although maybe more CPU) would be to use shiva physics with spherical dynamic bounding bodies for the pucks, centred about the pucks centre, same radius as the pucks. Then lock the angular rotation for X and Z using
dynamics.setAngularDampingEx ( hPuck, 1000000, 0, 1000000 )
if the above does not lock hard enough or it "creeps" then instead use this in each enterframe:
object.setRotation( hPuck, 0, 0, 0, object.kGlobalSpace)
Of course this spherical bounding body would cause the visible pucks to levitate over the table, so you would need to place the visible table (without collider) above an invisible collider object underneath.
Fraser,
http://www.silicondroid.com
http://www.silicondroid.com
4 posts
• Page 1 of 1
