[fluxus] advice about hijacking collision data

dave dave at pawfal.org
Tue Jan 31 18:19:25 PST 2006


On Sun, 2006-01-29 at 16:02 -0800, Alex wrote:
> Hi, so I like the idea of being able to detect collisions very easily,
> but I want to make a system where my objects don't have to obey other
> physics rules.  I don't want to have to have all of my objects obey
> the laws of gravity.  I'd basically like to decide on a per object
> basis what the object does if it collides... each object might have a
> different reaction to a collision, some may be to bounce off, some may
> fuse with other objects, change color, etc.

this is complex stuff, not all is possible with ode, and even less is
exposed in fluxus. however some things are possible.

> Can someone suggest a way i could do this?
> >From my early tests it seems that if I move objects myself (they are
> active cubes), with a gravity vector of (0 0 0), that (has-collided
> myob) is never true even if i can see that objects have collided.

are you running the cvs version? there is an example script to show you
how to do this (20-interactive.scm) which creates objects that change
colour when they collide.

> If I make a gravity vector of (0 -1 0) but make my objects passive I
> don't get any collision results either (again I am moving an object
> myself).

only active objects generate collision events - passive objects are just
bounding volumes in the scene, and aren't processed in the same way.
also, you can't manually move passive objects (you're just moving the
render geometry, not the physical bound - I should make this not
possible really as it's confusing)

we do need more information than (has-collided) currently gives you -
for instance we could attach objects together with joints when they
collide if we could get the id of the object the collision has occurred
with, or even break joints in the same way.

I'd also like to expose some indication of the force of the collision,
but I'm not sure there is a way to know that...

just looking at the ode docs, I notice that you can disable the force of
gravity for individual objects, but the value of gravity itself is
global to the world. a per object on/off this would be useful, I'll add
it to the todo list

> If this were an OO design I might like to be able to subclass a basic
> object type that would react to gravity and collisions.  In the
> subclass I could make my own collision method which may or may not
> call the superclass method.  Also, the draw method of the superclass
> would translate the object based on its velocity and gravity, and I
> could decide if I want to call that method or not in a subclass draw
> method.

there are a lot of restrictions with phsical simulations which mean it
isn't possible to move an object except through forces (this is sort of
clear, if you understand that the ode needs to be aware of an object's
translational and rotational velocities in order to calculate new
velocities based on collisions) 

so when you give an object to ode, you give up all direct control of its
movement, and can only affect it by modifying it's velocities through
kick and twist. there are ways of blending motion between the forces and
animation paths, but this is difficult to set up, and a bit far off atm
- I'd like to concentrate on more basic things like allowing arbitary
polygonal collision volumes.

cheers,

dave




More information about the Fluxus mailing list