Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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 1307 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?

Will.

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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (43 views)
2014-09-23 14:38:19

radar3301 (25 views)
2014-09-21 23:33:17

BurntPizza (62 views)
2014-09-21 02:42:18

BurntPizza (32 views)
2014-09-21 01:30:30

moogie (37 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!