Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  odejava - contact joint feedback  (Read 2264 times)
0 Members and 1 Guest are viewing this topic.
Offline Vikstar

Senior Newbie

« Posted 2004-07-09 03:13:55 »

Is there a way to get org.odejava.JointFeedback data from contacts, even if it's not currently supported by the org.odejava package and I have to go through the lowevel org.odejava.ode.Ode class?

I need to find the impulse at places of contact. I can get this from the force at the contact and the step size.
Offline Vikstar

Senior Newbie

« Reply #1 - Posted 2004-07-10 04:54:00 »

Ok, I've almost figured it out. It's a little rough, but only a "proof of concept". I don't know if it works, because I haven't been able to test it yet since my system framework isn't complete enough.

After calling the collide(Space) method on a JavaCollision instance, you iterate over the Contact class.

For each iteration, you create a dContact instance and use the Ode.dJointCreateContact method to return a SWIGTYPE_p_dJointID instance. Create a dJointFeedback instance, which can be applied to the constructor for JointFeedback. Use Ode.dJointSetFeedback on the SWIGTYPE_p_dJointID instance and the dJointFeedback instance. Use Ode.dJointAttach to attach the joint to the two bodies.

Now step your simulation, and you (hopefully) can read in up-to-date and correct JoinFeedback data.

Note: You won't need to ever call applyContacts() on a JavaCollision instance since we apply then manually.

Any comments?
Offline William Denniss

JGO Coder

Projects: 2

Fire at will

« Reply #2 - Posted 2004-07-10 20:21:11 »

what do you think is the best way to wrap this functionality in the high level API?


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Vikstar

Senior Newbie

« Reply #3 - Posted 2004-07-11 07:18:22 »

To wrap this functionality the way it is, perhaps create a JointContact class which accepts and uses a Contact instance to fill its properties. The user can then call the inherited (perhaps overriden) methods from the Joint class such as enableFeedbackTracking(), attach(Body, Body) and getFeedback().

It's a little hard to say since I wouldn't have created the high level collision API in quite the way it is now.

I would have created some sort of CollideListener interface which contains something like ode's nearCallback as its method. Instead of the user calling collide(Space), they would actually call collide(Space, CollideListener) or something to that extent. This would also require a collide method somewhere in the high level API which works like ode's dCollide function.

This would allow the user to create their own contact joints as they see fit. For example, the default nearCallback for odejava ignores contacts when the two touching bodies are connected by a joint. However, sometimes it is desirable to still create a contact especially if that joint is somehow separated from the two bodies (such as a distant hinge joint).

However, this would require a java method call from the c side of JNI, and I don't know what the performance impact of that would be. If the impact is unacceptable, then I understand the need for the current high level collision API using buffers from NIO.
Pages: [1]
  ignore  |  Print  

EgonOlsen (79 views)
2018-06-10 19:43:48

EgonOlsen (59 views)
2018-06-10 19:43:44

EgonOlsen (78 views)
2018-06-10 19:43:20

DesertCoockie (261 views)
2018-05-13 18:23:11

nelsongames (159 views)
2018-04-24 18:15:36

nelsongames (158 views)
2018-04-24 18:14:32

ivj94 (901 views)
2018-03-24 14:47:39

ivj94 (162 views)
2018-03-24 14:46:31

ivj94 (813 views)
2018-03-24 14:43:53

Solater (177 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!