Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Attaching a Joint to the Zero Body  (Read 1152 times)
0 Members and 1 Guest are viewing this topic.
Offline Vikstar

Senior Newbie





« Posted 2004-07-25 02:29:18 »

How do you attach a joint to a body and to the zero body?

For example, in the low-level api you would use Ode.dJointAttach(myJointId, myBodyId, Ode.getBODYID_ZERO()). However, the Joint classes don't have a getId() method, and there is no high-level equivalent for Ode.getBODYID_ZERO() to be able to use the high-level myJoint.attach(myBody1, myBody2).
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2004-07-25 12:02:44 »

Quote
there is no high-level equivalent for Ode.getBODYID_ZERO() to be able to use the high-level myJoint.attach(myBody1, myBody2).


There is now Smiley

update from CVS - and checkout the Body.BODYID_ZERO constant.  It's constructed with the single line:

bodyId = Ode.getBODYID_ZERO();

I hope that works, I don't have a test case to try it with Smiley

Will.

Offline Vikstar

Senior Newbie





« Reply #2 - Posted 2004-07-26 02:18:59 »

Thanks, I've updated my java with the latest CVS (was using the downloaded 0.3 snapshot before). The static BODYID_ZERO works perfectly.

P.S. This is a little off topic, but is related to zero bodies. Why is the native address updating in Geom's "protected void updateNativeAddr()" method commented out? I use getNativeAddr() to be able to identify with which geoms a particular contact occurs. I have to uncomment the line and recompile for it to work properly. Is there a better way of figuring out the precise geoms of a contact than using myContact.getGeomID1() with myGeom.getNativeAddr()? Note: Some of the geom's I use are static and don't have body's with which to use myContact.getBodyID1() etc.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2004-07-26 04:12:12 »

No probs.  I think it was commented out when it was causing some problems - you are right, it shouldn't be commented out. I'll look into it tonight.

I don't think there's a better way to get the Geoms of a contact at the moment, that code needs an overhaul.  How do you think it should be done?  Maybe we could change it so the methods return GeomS instead of ID's.  Idealy we don't want to have to know about ID's and native addresses in the high-level API.

Will.

Offline Vikstar

Senior Newbie





« Reply #4 - Posted 2004-07-27 02:23:04 »

Returning Geoms instead of geomIds would, i think, be the best quick fix, which would probably require a hashmap. I've implemented contacts in my project but have not really needed them yet (just testing other joints and bodies for the moment). When I start fully using contacts I'll send some suggestions if there is room for improvement in the API (such as creating a JointContact class etc)

Note: I'm using odejava for research, not a gaming. Some solutions or suggestions that I give may not scale well if you need real-time, as opposed to simulation where it is sufficient for say 10 minutes of simulation time to be computed over a couple of hours. However, I will try to keep in mind the gaming application of odejava.
Offline t_larkworthy

Senior Member


Medals: 1
Projects: 1


Google App Engine Rocks!


« Reply #5 - Posted 2004-07-27 17:49:01 »

maybe things like Geoms and Body classes should have static hashmaps which have the map between ids and objects inside them. An entry is put in at creation time and removed when the object is delete()d.
This could be extended to worlds as well when multiple worlds are done.

Runesketch: an Online CCG built on Google App Engine where players draw their cards and trade. Fight, draw or trade yourself to success.
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.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (67 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
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!