Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (428)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Mechanics / Possible incompatibility with ODE! on: 2005-04-27 15:04:21
Hello,

As i described in the topic below, i want to test collision of two geoms with odejava.

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=physics;action=display;num=1114546020

When i looked for the problem in Odejava sources, i found the following lines in the methods written in odejava.cpp:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
// This callback collects all contacts data (dContactGeom) to buffers which
// can be later accessed on the Java side.
// Used with spaceCollide
static void nearCallback (void *data, dGeomID o1, dGeomID o2) {  
  // This function is called by ODE if two Geoms are near each other.
 // Geoms o1 and o2 are near each other, if they actually collide then
 // generate contact information (dContact structure) and add them
 // to contact jointgroup.

  dBodyID b1 = dGeomGetBody(o1);
  dBodyID b2 = dGeomGetBody(o2);

  // ignore if both o1 and o2 are plain Geoms (not bodies)
 if (!b1 && !b2) return;

  .....


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
// This callback collects all contacts data (dContactGeom) to buffers which
// can be later accessed on the Java side.
// Used with spaceCollide2
static void nearCallback2 (void *data, dGeomID o1, dGeomID o2) {  
  // This function is called by ODE if two Geoms are near each other.
 // Geoms o1 and o2 are near each other, if they actually collide then
 // generate contact information (dContact structure) and add them
 // to contact jointgroup.
 if (dGeomIsSpace (o1) || dGeomIsSpace (o2)) {
      // colliding a space with something
     dSpaceCollide2 (o1,o2,data,&nearCallback);
      // collide all geoms internal to the space(s)
     if (dGeomIsSpace (o1)) dSpaceCollide ((dSpaceID) o1,data,&nearCallback);
      if (dGeomIsSpace (o2)) dSpaceCollide ((dSpaceID) o2,data,&nearCallback);
  } else {

    dBodyID b1 = dGeomGetBody(o1);
    dBodyID b2 = dGeomGetBody(o2);

    // ignore if both o1 and o2 are plain Geoms (not bodies)
   if (!b1 && !b2) return;

    .....


It seems that collision of two geoms are ignored in the implementation.

Here is the related "collision" section from ode user guide:

http://www.ode.org/ode-latest-userguide.html#sec_10_2_0

So, it seems that the current behavior is not compatible with what ODE says. I think this is done to improve performance in odejava. So, what are your thoughts? Should we compliant to ode or select performance option? Are there anybody using geom-geom collision?

Thanks for the opinions.
2  Game Development / Game Mechanics / Geom collision on: 2005-04-26 20:07:00
Hello,

I want to create an application which tests the collision of geoms (not bodies). When i run the following program, i get contact counts as zero. Do you have any idea about what the problem is?

(In fact i want to test collision of trimeshes but this simple example just test collision of a sphere and a box)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
public class TestBoxSphereGeomCollision {

   World world;
   HashSpace space;
   JavaCollision collision;
   Contact contact;

   GeomBox box;
   GeomSphere sphere;

   public TestBoxSphereGeomCollision() {
       
        Odejava.getInstance();
        initWorld();
        initObjects();
       
        for (int i=0; i<100; i++) {
            step();
        }
       
        cleanup();
   }

    private void initWorld() {    
        world = new World();
        world.setGravity(0f, 0f, 0f);
        world.setStepInteractions(10);
        world.setStepSize(0.05f);
       
        collision = new JavaCollision(world);

        contact =
                new Contact(
                collision.getContactIntBuffer(),
                collision.getContactFloatBuffer());
       
        space = new HashSpace();
       
        collision.setSurfaceMode(0);
        collision.setSurfaceMu(Float.MAX_VALUE);
    }

    private void initObjects() {

        box = new GeomBox("box1", 15, 15, 15);
        box.setPosition(0f , 0f, 0f);        
       
        space.addGeom(box);
       
        sphere = new GeomSphere("sphere1",  20);
        sphere.setPosition(0f , 0f, 1f);        
        space.addGeom(sphere);
    }

    public void step() {
   
        //collision.collide(space);
       collision.collide2(box.getNativeAddr(), sphere.getNativeAddr());
       // Note that i tried both versions of colliding written above

        iterateContacts();
        collision.applyContacts();
       
        world.stepFast();
    }    

    private void iterateContacts() {
       
        System.out.println("ContactCount: "+collision.getContactCount());

    }

    public void cleanup() {
        space.delete();
        collision.delete();
        world.delete();
        Ode.dCloseODE();
    }
}
3  Game Development / Game Mechanics / Re: [Odejava] Citation for article on: 2005-04-16 06:22:32
Hi Vikstar,

You can site odejava web (or forum) site, if you can not find another way.

http://www.bedfordstmartins.com/online/cite8.html

By the way, i am interested in "java and robotics". If it will not be a problem, can you send the sources of your work (with paper if possible) to me? (levent.bayindir@gmail.com)

Thanks.

4  Java Game APIs & Engines / JOGL Development / Re: J3d port to Jogl on: 2005-03-20 20:37:39
Hi, you may look at these urls:

http://java3d.virtualworlds.de/j3dwiki/index.php/How_can_I_use_Java_3D_and_OpenGL_together%3F

http://www.javadesktop.org/forums/thread.jspa?threadID=3222&tstart=0

They describe how JOGL code can be used within the Java3D environment.
5  Java Game APIs & Engines / JOGL Development / Re: Menu displayed behing GLCanvas on: 2005-03-18 13:23:52
I think you should make your menu items heavyweight.

You can look at this tip:

http://javaalmanac.com/egs/javax.swing/PopupHw.html
6  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-17 19:01:32
I tested it.

After adding deepCopy(Object oldObj)  method to DOMUtil class and implementing clone() method of XODEObject, it worked.

I am waiting for your ack. to commit the changes.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
// returns a deep copy of an object
  static public Object deepCopy(Object oldObj) throws Exception
   {
      ObjectOutputStream oos = null;
      ObjectInputStream ois = null;
      try
      {
         ByteArrayOutputStream bos =
               new ByteArrayOutputStream();
         oos = new ObjectOutputStream(bos);
        
         // serialize and pass the object
        oos.writeObject(oldObj);  
         oos.flush();              
         ByteArrayInputStream bin =
               new ByteArrayInputStream(bos.toByteArray());
         ois = new ObjectInputStream(bin);                  
        
         // return the new object
        return ois.readObject();
      }
      catch(Exception e)
      {
         System.out.println("Exception in ObjectCloner = " + e);
         throw(e);
      }
      finally
      {
         oos.close();
         ois.close();
      }
   }


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
public Object clone() {

            XODEObject object = null;
            
            try {
                  object = (XODEObject)DOMUtil.deepCopy(this);            
            } catch(Exception e1) {
                  System.out.println(e1);
            }
            
            object.setParent(null);
            return object;
      
      }


Thanks.

Levent
7  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-17 05:02:40
Thanks for the quick replies and works.

Quote
...  The clone method would have to exist in the XODEObject (or an extension of that class) so it is able to call the protected XODEObject.setParent method passing 'null' (the use of that method is explicitally not recommended unless one is very aware of the implications of using it, which in this case we are and it is the correct thing to do).


It seems that i should implement clone() method of XODEObject. I should add a method to XODEUtil class (i could not remember its name now and i do not have the source now) to clone objects using serialization (i gave the reference for alternative serialization method before) and use that method in XODEObject's clone method plus setting the parent null.

Are these changes acceptable for you?

Levent.
8  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-16 19:11:46
Addition to second item:

When i used the document object obtained from XODEParser (xodeParser.getDocument()) added-child is not shown after serialization!

So i think Document object is not updated in any way, now.

9  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-16 18:19:31
Hi,

As planned before, i tried to implement "save/save as" in jphyswiz and test xode exporting feature.

Here are the problems i found:

1. I need to clone XODEObjects for copy/pasting operations. When i clone a node and tried to add that node under a container (using addChild method) i get an XODEException, since setParent(..) method in XODEObject does not allow to to change parent if you have one already. So we need to modify something there. What are your thoughts?

2. I looked at XODERoot but can not find getDocument method for exporting. Are you sure that you commited the changes?

3. It seems that "adding ability to add/remove child XODEObjects from XODEContainers ..." is in todo list. Isn't this already implemented? This is also a very important requirement for jphyswiz now.

Levent.
10  Game Development / Game Mechanics / Re: Adding log4j and xerces to lib directory in cv on: 2005-03-15 17:45:18
I added them to the cvs.  Roll Eyes Thanks.
11  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-13 21:38:14
Here are related parts:

Indenting (false)
If true, then the serializer will add indents at each level and wrap lines that exceed the maximum line width. If false it won't. The number of spaces to indent is set by the indent property, and the column to wrap at is set by the line width property.

public void setIndenting(boolean indenting);
public boolean getIndenting();

Indent (4)
The number of spaces to indent each level if indenting is true.

public void setIndent(int indent);
public int getIndent();

Line width (72)
The maximum number of characters in a line when indenting is true. Setting this to zero turns off line wrapping completely.

public void setLineWidth(int width);
public int getLineWidth();


So, we can set a line width, set indenting to true and give an indent value. The best way is this i think. I read "Creating DOMWriters" section too and it does not solve this problem either. (it just can select which nodes can be printed)

Example code:
1  
2  
3  
format.setLineWidth(40);
format.setIndenting(true);
format.setIndent(6);
12  Game Development / Game Mechanics / Re: [Odejava] new: XODE XML exporting! on: 2005-03-13 20:33:35
Hi,

Thanks again for adding this functionality.

It seems that adding a few lines of code will solve the first dot. Smiley (no need to create an OutputFormat)

http://www.cafeconleche.org/books/xmljava/chapters/ch13s02.html

I will try it and post the results.

13  Discussions / Community & Volunteer Projects / Re: Project Proposal: JPhysWiz on: 2005-03-11 19:14:48
Thanks for such a nice comment. I hope so.
14  Java Game APIs & Engines / Java 3D / Re: Selection of opengl or directx renderer at run on: 2005-02-18 12:55:01
The answer to my question can be found here: http://www.javadesktop.org/forums/thread.jspa?messageID=58017
15  Java Game APIs & Engines / Java 3D / Selection of opengl or directx renderer at runtime on: 2005-02-16 19:03:16
I am opening 3d view of my files in my program.
I want to specify renderer type (opengl or directx) for each file at runtime. (for example using a combo box)

So there may be two java3d windows at any time: one of them using opengl renderer and the other one using directx renderer.

Is this possible now, or can it be possible in the future?
16  Java Game APIs & Engines / Java 3D / Re: java3d and odejava on: 2005-02-16 18:53:52
There is a java3d binding for odejava.

You can download it from here:
https://odejava.dev.java.net/servlets/ProjectDocumentList?folderID=1837&expandFolder=1837&folderID=1836


17  Game Development / Game Mechanics / Adding log4j and xerces to lib directory in cvs on: 2005-02-06 15:23:12
I want to ask if it is possible to add xerces and log4j libraries to the lib directory of odejava, because they are required in build process and does not come with j2sdk.

The reason for me is that i dont want to put those libraries into jre's path(i know i can modify build script and add them to lib), because i need to include my own xerces and log4j libraries with my application. This will make my tests buggy.

I dont think, this is the right approach as far as i understand. (Requiring every user to download them seperately and modifying build script)

What are your thoughts about this?
18  Game Development / Game Mechanics / Re: [ODE Java] How to install? on: 2004-12-05 18:27:28
I think this is related to your IDE. I am not using Eclipse.

Simply, log4j.jar should be in your classpath.

You can try to copy log4j.jar to your JRE's ext directory.
Ex: C:\jdk1.5.0\jre\lib\ext

If odejava.dll will not be found, you can copy it to your JRE's bin directory. Ex: C:\jdk1.5.0\jre\bin  
19  Game Development / Game Mechanics / org.odejava.display package and custom models on: 2004-10-18 21:16:04
Is it possible to use custom models (ex. lightwave models) for my objects using org.odejava.display package?

I am also interested with extending XODE for using custom models. Is it possible? If so how?

Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (79 views)
2014-04-15 18:08:23

BurntPizza (71 views)
2014-04-15 03:46:01

UprightPath (82 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (82 views)
2014-04-14 15:48:38

tom_mai78101 (106 views)
2014-04-10 04:04:31

BurntPizza (166 views)
2014-04-08 23:06:04

tom_mai78101 (262 views)
2014-04-05 13:34:39

trollwarrior1 (212 views)
2014-04-04 12:06:45

CJLetsGame (221 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!