Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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 1457 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 »

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


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.


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 Devvie

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.

BurntPizza (22 views)
2015-10-07 02:11:23

KaiHH (23 views)
2015-10-06 20:22:20

KaiHH (11 views)
2015-10-06 19:41:59

BurntPizza (24 views)
2015-10-06 19:04:48

basil_ (44 views)
2015-09-30 17:04:40

shadowstryker (22 views)
2015-09-29 15:55:06

TheSpaceHedgehog (28 views)
2015-09-29 01:58:48

GamerC4 (54 views)
2015-09-24 21:10:38

GamerC4 (71 views)
2015-09-24 21:09:48

htuy (28 views)
2015-09-24 04:57:24
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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!