Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (523)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (591)
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] JavaCollision shenanigans  (Read 1451 times)
0 Members and 1 Guest are viewing this topic.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Posted 2004-02-27 23:42:37 »

I am very close now to removing all of the code in Odejava.java relating to the static storage of the current World/Space and JointGroup objects.

Here's the bind:

If you compile the current CVS, you will get 5 warnings, relating to the use of setCurrentWorld.

Since both setCurrentWorld and getCurrentWorld are marked as deprecated and the internal objects are private, you may ask as I did: "if nobody is using the getCurrentWorld(), why is setCurrentWorld() being used?".

This is a very good question.  One I am hoping Jani may be able to help me with.  The problem is that if you don't call setCurrentWorld - the shit hits the fan nativly in the JavaCollision class.  This is despite the fact that it never calls getCurrentWorld (from within Java code).

Here's the dump:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
Unexpected Signal : 11 occurred at PC=0x4DCF3F36
Function=(null)+0x4DCF3F36
Library=/usr/java/j2sdk1.4.2_03/jre/lib/i386/libodejava.so
 
NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.
 
 
Current Java thread:
        at org.odejava.collision.JavaCollision.createContactJoints(Native Method)
        at org.odejava.collision.JavaCollision.applyContacts(JavaCollision.java:153)
        at org.odejava.test.car.Car.step(Car.java:473)
        at org.odejava.xith3d.test.CarExample.render(CarExample.java:237)
        at org.odejava.xith3d.test.CarExample.main(CarExample.java:108)
 


Everyone's favourite SIGSEGV ;-)

Can you please look into this code Jani?

Once this is cleared up then those static methods will be gone forever from Odejava.

Cheers,

Will.

Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #1 - Posted 2004-02-28 12:48:25 »

Quote
I am very close now to removing all of the code in Odejava.java relating to the static storage of the current World/Space and JointGroup objects.


Excellent! I'll check this today or tomorrow latest.

Quote

This is a very good question.  One I am hoping Jani may be able to help me with.  The problem is that if you don't call setCurrentWorld - the shit hits the fan nativly in the JavaCollision class.  This is despite the fact that it never calls getCurrentWorld (from within Java code).


The answer is found from odejava.cpp. I'll check this issue later but for now you must set the world (once) before stepping simulation ahead.

Here's a fix:

public void stepFast() {
 Ode.setWorldID(worldId);
 Ode.dWorldStepFast1(worldId, stepSize, stepInteractions);
}

public void step() {
 Ode.setWorldID(worldId);
 Ode.dWorldStep(worldId, stepSize);
}

So add Ode.setWorldID(worldId); line to both methods, this will remove the crash you got.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #2 - Posted 2004-02-28 22:45:37 »

I tried that temporary fix but still had the same problem but I didn't look to deeply into it.  There's no hurry.

Another question I have is regarding Geom which is attached to the zero space - it is perfectly ok to call any of the methods on it is it, even before it's added to a Space?

Currently there is a check to prevent this but I am thinking that some of these can be safely removed.  However I will leave an assertion in the addToSpace method to ensure that a Geom can't be added to a Space if it's already in one (the correct procedure is of course to remove it first) and I'll probably make this method final as well.

Cheers,

Will.

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

Junior Devvie




Do it with Java!


« Reply #3 - Posted 2004-02-29 04:47:33 »

Quote
I tried that temporary fix but still had the same problem but I didn't look to deeply into it.  There's no hurry.


Sorry, I gave wrong instructions, I should have checked this from the source code and not rely on my memory alone.

Currently Odejava supports only single World. Odejava.cpp needs to be converted from static into instantiable class, after this is done the setCurrentWorld method can be removed and then Odejava supports multiple Worlds.

Let's keep setCurrentWorld method for now, I also removed deprecated status from setCurrentWorld as it is required for now.  I'll add multiple world support for Odejava later after some more important things are done.

Quote

Another question I have is regarding Geom which is attached to the zero space - it is perfectly ok to call any of the methods on it is it, even before it's added to a Space?


ODE's own documentation can help out here. Although it is  somewhat sparse on some areas. If the documentation won't tell this, then you need to ask it from q12.org or try i out yourself.

Quote

Currently there is a check to prevent this but I am thinking that some of these can be safely removed.  However I will leave an assertion in the addToSpace method to ensure that a Geom can't be added to a Space if it's already in one (the correct procedure is of course to remove it first) and I'll probably make this method final as well.


There's some things that user can do in "wrong order" and on some cases ODE won't even complain anything but can ignore some setting that was done too early. This is just a hunch that I have based on my ODE experience.

Optimally Higher Level API should make all kinds of checks and make sure processes are executed in right order. This requires some testing if you wish to find most problematic cases out.

At this point I wouldn't worry if HL API does not contain all the asserts that it should have. Just make sure the demos work so Odejava newbies see how things should be done.
Offline Jani Laakso

Junior Devvie




Do it with Java!


« Reply #4 - Posted 2004-02-29 05:06:15 »

I removed all deprecated World.setCurrentWorld calls from the demos. They are no longer required.

Deprecated status is back online with setCurrentWorld Smiley

Current world is now set when creating a World. There's an assert on the class to make sure that World is created only once for now. This will be removed when multiple world support works properly on Odejava. It's not a big task but requires me to convert Odejava.cpp into object oriented class.

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #5 - Posted 2004-02-29 10:05:24 »

Great Smiley

The demos worked calling the methods on the Zero Space so I will assume it is no problem.  Hence I removed these redundant asserts (but still leaving some which do matter).

Will.

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.

trollwarrior1 (34 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (66 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!