[ODE] Acquiring & editing dContact structures after contact
jointgroup is created
Jani Laakso
jani.laakso at itmill.com
Fri Feb 6 12:19:14 MST 2004
I'll start my post by saying, ODE is one fine project, but that is
something you all knew already :) Now I have another question to bother
you all, hope you hardcore ODE user can enlighten my understanding
towards ODE's dContact and contact jointgroup handling.
First I'd like to tell you that I'm trying to accomplish. We have a
project called Odejava and it basically allows ODE usage for Java users.
I am now adding some of the nearcallback functionalities to Java side
(some are best to leave still on C side) and acquiring + editing
collision related data before actually stepping the world.
Here's my question, I'd like to have an option to still use pure C
nearcallback solution but edit dContact structures before calling
dWorldStep. I think this option would be good for Java users as the
fastest solution. How is this possible? Here's what I have tried:
1. I call dSpaceCollide
-this possibly calls nearcallback several times, which possibly creates
dContact structures into contactJoints and sets contactJoints into
contact jointgroup by calling dJointCreateContact.
2. I iterate contact joint group's dContact structures
-at this point, I can read dContact structures fine, but if I edit e.g.
dContact.surface values it does not work
3. I call dWorldStepFast1
-uses old dContact values generated by nearcallback
-I assume dJointCreateContact (worldID,contactGroupID,&contacts[i]); in
nearcallback duplicates dContact structures?
Here's the code (hack) I've used for accessing dContact structures on
process 2.
Hack for accessing contact data (dContact) stored in contact jointgroup:
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;
}
Why doesn't the upper structure return such dContact structures that
affect also to the simulation when one calls dWorldStep, what have I
done wrong?
If someone can come up with a better solution for accessing dContact
structures, then it would be fun to see. I'm a Java guy and my C sure is
rust.
If I bring dContact structures to Java side beetween dCollide() and
dJointCreateContact calls, I can edit values nicely on the Java side and
lastly call dJointCreateContact. This solution works but this one is the
slower option for handling Odejava simulations.
Here's couple assumptions, can someone check if they are correct:
dCollide does not care of dContact structure, it only creates results as
dContactGeom.
dWorldStep is the only function that actually uses dContact structure
values, so I should be able to change dContact values before dWorldStep
call?
--
Jani Laakso / IT Mill Ltd | Tel. +358 40 5898086 | http://www.itmill.com
More information about the ODE
mailing list