Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Kenny77
17
Years of Service
User Offline
Joined: 7th Oct 2006
Location:
Posted: 20th Jan 2007 21:47
Can someone help me understand Darkphx collisions? I want to make collision detection between my own models, but it never seems to work.
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 20th Jan 2007 22:24
Collisions are fairly straight forward. You check to see if there is any active collisions on the stack with
phy get collision data() <> 0

then you need to check both objects for collision
a =PHY GET COLLISION OBJECT A ()
b =PHY GET COLLISION OBJECT B ()

at this point you make whatever decision is appropriate to you application

I have included part of a routine I use







Hope this was helpful

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
JerBil
20
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 20th Jan 2007 22:27 Edited at: 20th Jan 2007 22:28
Sorry if I'm being too basic, here, but this is the way you get collision data.


Then, check to see what items are in c and d.


One thing I found is that if object numbers for d
are higher than c, you have to use the opposite code,
that is,
if d=enemy1 and c=wall

Ad Astra Per Asper
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 20th Jan 2007 22:54
Jerbil

Quote: "
`-check for collisions-
while phy get collision data ( ) = 1
c=phy get collision object a()
d=phy get collision object b()
endwhile
"


Within 1 cycle you can have multiple collisions on the stack your code will only work if the object you are trying to react to are on the bottom of the stack. In other words you need to react to the collision with some form code ( your do stuff) before the endwhile

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
JerBil
20
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 21st Jan 2007 01:10 Edited at: 21st Jan 2007 03:04
Codger,
I wondered about that, but I'm getting all expected
collisions in my game, so don't know if I need to change anything.
Thanks for the info, though.

EDIT:
Godger, thanks. You caused me to re-think some, and my code is
better for it.

Ad Astra Per Asper
VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 25th Jan 2007 20:07
Yeah Codger is definitely right on about this topic Jerbill, but you must have just been 'lucky' =). As soon as you started adding more to your game/sim then you'd not be getting every collision reported to you.

This technique they chose for handling collisions is really slow however, and I am really looking forward to an update to the DarkPhysics library that would allow us more discreet control over the detection of collisions. I have a game I created with DarkPhysics and once I finally added the collision routines, only for the purpose of adding sound effects, my framerate dropped to a really unacceptable level. And trust me I did lots of optimization and timing tests but the 'While phy get collision data()=1' is just very slow. Maybe just a filter command of some sort that lets us only see collisions that are above a certain threshold of velocity. A lot more could be done anyway. But at least it's easy to use and does work well as it is.

VRMan

World Famous 3D Screensavers
-- http://www.vrman3d.com --

Login to post a reply

Server time is: 2024-05-08 23:43:21
Your offset time is: 2024-05-08 23:43:21