[ODE] Collision detection questions
Nolan J. Darilek
nolan at thewordnerd.info
Tue Nov 9 21:35:37 MST 2004
While I played with ODE briefly a year ago, recently I've been delving
into it far more heavily. Anyhow, I have a few questions/confusions,
and am hoping that some of you might help to clear them up. I'm new to
coding with physics engines, so my apologies for the rather
rudimentary questions.
My project is an asteroids-like 2-D game. Currently, asteroids are
represented by spheres and the player's ship is a cyllinder. Basic
collision detection works; asteroids collide with themselves and the
player quite nicely.
First, a simple question, one that I think I know the answer to but
just want to be sure about. Each object has a series of tangible and
intangible geometries. Tangible geometries are those comprising the
object itself, while intangible geometries are mainly for
informational/gameplay purposes. For instance, the player's ship has
an intangible crosshair geometry ray which, when an asteroid
intersects it, triggers a cockpit alarm indicating that the asteroid
is in firing range. Additionally, each asteroid has a path geometry
which, upon colliding with the player, triggers a collision warning
alert. If I don't want these intangible geometries to effect the
environment, do I simply not attach a contact joint between them? Or
is there more to it than that?
Now, a more complex issue. I'm having trouble conceptualizing how this
might work, so detailed examples/instructions would be very
helpful. As mentioned previously, I'm attaching intangible geometries
to objects which I'd like to trigger collision warning alerts in the
cockpit. As asteroids are spherical, I pondered using a capped
cylinder lying on its side, with one end against the sphere's outer
surface in the direction of travel. This doesn't seem to work,
however. That is, it triggers the alert, but not at the correct
time. I'm thinking, therefore, that I haven't rotated/positioned the
cylinder correctly. So, here's the simplistic conceptual model I'm
using in my head to visualize this. If anyone could help me translate
this into ODE structures then it'd be greatly appreciated. :)
I'm imagining a tennis ball of radius 1 inch, and a can of the same,
but 4 inches long. I want to place the flat end of the can such that
it is always in the tennis ball's line of motion (note that I'm using
very basic "arcade" physics in which objects move in whichever
direction they're facing. :) So if I place the sphere geometry at
(0,0,0), to affix the can to its front by its end I'd place it at
(2.5, 0, 0), allowing for the ball's radius+half the can's length. At
this point I'm assuming I'd have to rotate the can, as the docs claim
it's aligned along the sphere's local Z, so I'd rotate it either pi/2
or 3/2pi radians to the right or left to place it on its side.
Am I remotely correct? I suspect that, if I'm misunderstanding
something then it's regarding the cylinder's location or rotation, but
I have no idea whether the values I'm plugging in are correct.
Thanks.
More information about the ODE
mailing list