[ODE] Acquiring & editing dContact structures after contact jointgroup is created

Jani Laakso jani.laakso at itmill.com
Fri Feb 6 21:02:23 MST 2004


Jon Watte wrote:

>What I do in my C# wrapper is to collect an array of collisions in a native
>callback. Then I pass this array back as the result of SpaceCollide (or
>collide, for that matter). Then I let the managed code create the contacts
>it wants out of this array, before calling WorldStep. That seems to work
>fine.
>  
>
Thanks for answering. However, I got this to work already, but this 
makes one (undeeded) Java call per each nearCallback call. I'd like to 
offer Odejava users also another solution. Keep nearcallbacks still on C 
and allow users to change dContact structures just before stepping the 
world.

My problem was related to manipulating dContact structures just before I 
step the world (dWorldStep), how is this possible? I added some code to 
ODE which allowed me to iterate all dContact structures based on a given 
jointgroup (contact joint group of course), I can access all the values 
nicely but if I change e.g. the friction to something else, still 
dWorldStep acts with older values, this makes me wonder where I did wrong??

Here's the code I use for reading dContact structures just before 
stepping the world:
static dxJoint *currentJoint;
int initContactGroup (dJointGroupID group)
{
 currentJoint = (dxJoint*) group->stack.rewind();
 return group->num;
}
dContact getNextContact (dJointGroupID group)
{
 dxJointContact *jc = (dxJointContact*) 
group->stack.next(currentJoint->vtable->size);
 return jc->contact;
}

I'd appreciate if someone checks this.

>This assumes that you know how to wrap a dContact in your non-native
>language; that should be no different from wrapping, say, dMass.
>  
>
I'm using Swig for generating the Lower Level Java API. Does it so easily.

-- 
Jani Laakso / IT Mill Ltd | Tel. +358 40 5898086 | http://www.itmill.com




More information about the ODE mailing list