Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 121 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject: Re: Java port of Bullet
PostPosted: Fri Oct 16, 2009 1:26 pm 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
vinpowful wrote:
Hi, jezek2 !
Since few days, i'm unable to go on the website http://jbullet.advel.cz/ , I get an 403 error :?
I'm a student and i'll surely use JBullet for a big project, is there another place to get the last version and find Javadoc / API reference ?

thank you and keep up the great work :)

Oh, fixed now. Thanks for reporting.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Tue Nov 24, 2009 4:05 pm 
Offline

Joined: Tue Nov 24, 2009 3:58 pm
Posts: 5
Hi, i am currently trying to integrate jbullet into my own project. I am using netbeans and used the build script to build jbullet. After this i added all generated libraries (jar files in the dist folder) into my own project. Then i integrated (basically copied) some code from the hello world file into my main file and tried to run the program but i get the following error:

Exception in thread "main" java.lang.Error: not instrumented
at cz.advel.stack.Stack.alloc(Stack.java:110)
at com.bulletphysics.collision.broadphase.AxisSweep3Internal.<init>(AxisSweep3Internal.java:90)
at com.bulletphysics.collision.broadphase.AxisSweep3.<init>(AxisSweep3.java:52)
at com.bulletphysics.collision.broadphase.AxisSweep3.<init>(AxisSweep3.java:48)
at environement.Physics.PhysicsWorld.initPhysics(PhysicsWorld.java:65)

I already found something here to solve the problem but i do not understand it.

Can somebody help me?

Thanks,
Thomas


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Nov 25, 2009 8:53 am 
Offline

Joined: Tue Nov 24, 2009 3:58 pm
Posts: 5
I got it to work :) The problem seems strange to me but it seems that cross referencing libraries from the jbullet netbeans project to my own netbeans project produced the bug. If i copy the generated libraries (the generated dist folder of the jbullet project) into some folder without a netbeans project in it and use this libraries in my own netbeans project everything works fine.

Bye,
Thomas


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Fri Dec 04, 2009 1:47 am 
Offline

Joined: Wed Sep 09, 2009 5:52 pm
Posts: 5
I stumbled onto JBullet today, and I'm very impressed with it. It runs very well and, at least on my system, it's hard to tell it apart from the original Bullet. I do, however, have some questions:
Why are you using a separate library for stack allocation when automatic stack allocation was added in Java 6? ( http://www.ibm.com/developerworks/java/ ... 09275.html )
Do you plan to implement the KinematicCharacterController, and/or would it be difficult for someone with less experience (like me) to implement?


Edit:
I seem to have answered my own questions to a certain degree.
It looks like KinematicCharacterController is already in the repository after someone on JavaGaming.org implemented it, and I'm seeing people complaining that Java's stack allocation is really too conservative.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Dec 09, 2009 12:23 am 
Offline

Joined: Fri Jan 11, 2008 8:33 am
Posts: 40
debio264 wrote:
Why are you using a separate library for stack allocation when automatic stack allocation was added in Java 6? ( http://www.ibm.com/developerworks/java/ ... 09275.html )

Please note the article publish date, it was written before Java 6 release and the actual release didn't have such capability. Current status is that in some development builds of Java 7 there is such option but only available on Server VM. There is probably backport to some Java 6 update, but would need to check. On older computers Server VM introduces serious lags throughput the whole application run so it's not option for interactive applications.

debio264 wrote:
... and I'm seeing people complaining that Java's stack allocation is really too conservative.

Not sure what you mean, can you describe it more?


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Wed Dec 09, 2009 6:47 am 
Offline

Joined: Wed Sep 09, 2009 5:52 pm
Posts: 5
jezek2 wrote:
debio264 wrote:
Why are you using a separate library for stack allocation when automatic stack allocation was added in Java 6? ( http://www.ibm.com/developerworks/java/ ... 09275.html )

Please note the article publish date, it was written before Java 6 release and the actual release didn't have such capability. Current status is that in some development builds of Java 7 there is such option but only available on Server VM. There is probably backport to some Java 6 update, but would need to check. On older computers Server VM introduces serious lags throughput the whole application run so it's not option for interactive applications.

debio264 wrote:
... and I'm seeing people complaining that Java's stack allocation is really too conservative.

Not sure what you mean, can you describe it more?


Escape analysis is available as an experimental feature in JRE 6u14 (see http://java.dzone.com/articles/escape-a ... a-6-update), so yea, you're right, it's not mainstream yet. You should probably try it out though.
As for the conservative thing, it's a comment I saw in a few places, but given that it's still an experimental feature, I should probably just ignore those until it becomes official. By conservative, the posters meant that escape analysis was too cautious in its optimizations.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Fri Dec 18, 2009 7:22 pm 
Offline

Joined: Fri Dec 18, 2009 7:19 pm
Posts: 11
Exception in thread "main" java.lang.Error: not instrumented
at cz.advel.stack.Stack.alloc(Stack.java:110)
at com.bulletphysics.collision.broadphase.AxisSweep3Internal.<init>(AxisSweep3Internal.java:90)
at com.bulletphysics.collision.broadphase.AxisSweep3.<init>(AxisSweep3.java:52)
at com.bulletphysics.collision.broadphase.AxisSweep3.<init>(AxisSweep3.java:48)
at environement.Physics.PhysicsWorld.initPhysics(PhysicsWorld.java:65)


I am still having troubles on Eclipse trying to debug the application. And yes, I succeded building the source via ANT. But the only way I found to run is via ANT though. So I cannot debug it.
Is there a way to run and debug the code "normally" ?

Somebody can please help me?

Thank you.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Sat Dec 19, 2009 5:02 am 
Offline

Joined: Wed Sep 09, 2009 5:52 pm
Posts: 5
Take a look at the build instructions - you've missed a step somewhere if you're getting that error.
Are you sure you built the project with Ant, and if so, what command did you use?


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Mon Dec 21, 2009 4:01 pm 
Offline

Joined: Fri Dec 18, 2009 7:19 pm
Posts: 11
I've made my way and it worked.

Now, another question. It's possible to load a custom model and use its mesh to run some simulations?

Thank you.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Mon Dec 21, 2009 5:18 pm 
Offline

Joined: Wed Sep 09, 2009 5:52 pm
Posts: 5
Yes, the same way you would with plain old Bullet. Check the demos for examples.
A physics library wouldn't be very useful if it could only use hardcoded primitives.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Fri Dec 25, 2009 6:00 pm 
Offline

Joined: Fri Dec 18, 2009 7:19 pm
Posts: 11
Sure debio.

But there is only the MovingConcaveDemo(bunny thing) that reads a static array of vertices and faces indexes.

So I've been trying to write my own Model Loader based on that structure(vertices and indexes). The routing reads the data from a file generated from a maxscript exporter I wrote.
And it didn't worked.

The exception below just keep coming and I cannot figure it out.

Code:
java.lang.IndexOutOfBoundsException
   at java.nio.Buffer.checkIndex(Buffer.java:520)
   at java.nio.DirectByteBuffer.getFloat(DirectByteBuffer.java:806)
   at com.bulletphysics.collision.shapes.ByteBufferVertexData.getVertex(ByteBufferVertexData.java:58)
   at com.bulletphysics.extras.gimpact.TrimeshPrimitiveManager.get_vertex(TrimeshPrimitiveManager.java:121)
   at com.bulletphysics.extras.gimpact.TrimeshPrimitiveManager.get_primitive_triangle(TrimeshPrimitiveManager.java:138)
   at com.bulletphysics.extras.gimpact.TrimeshPrimitiveManager.get_primitive_box(TrimeshPrimitiveManager.java:128)
   at com.bulletphysics.extras.gimpact.GImpactBvh.buildSet(GImpactBvh.java:127)
   at com.bulletphysics.extras.gimpact.GImpactShapeInterface.calcLocalAABB(GImpactShapeInterface.java:204)
   at com.bulletphysics.extras.gimpact.GImpactShapeInterface.updateBound(GImpactShapeInterface.java:71)
   at com.bulletphysics.extras.gimpact.GImpactMeshShape.calcLocalAABB(GImpactMeshShape.java:237)
   at com.bulletphysics.extras.gimpact.GImpactShapeInterface.updateBound(GImpactShapeInterface.java:71)
   at br.com.rsl.temp.ModelLoader.buildTriMesh(ModelLoader.java:45)


The data generated looks like this:
Code:
6
0.0 -0.907649 0.419731
0.0 -0.907649 0.419731
0.0 -0.907649 0.419731
0.900354 0.0 0.435159
0.0 0.907649 0.419731
0.0 0.0 -1.0
8
1.0 2.0 3.0
1.0 3.0 4.0
1.0 4.0 5.0
1.0 5.0 2.0
2.0 6.0 3.0
3.0 6.0 4.0
4.0 6.0 5.0
5.0 6.0 2.0

6 vertices and 8 faces.
It's a simple piramid. A primitive in 3ds max.

It seems the problem is floating around the "vertex stride" thing. Which I am using the same value(4 * 3) from the bunny example: MovingConcaveDemo.java:111

Why is 4*3? And why the ByteBuffer objects are being created by multiplying the vertices and indexes by 4?
Code:
ByteBuffer.allocateDirect(indexes.length * 4).order(ByteOrder.nativeOrder());


How can I determine an adaptive way to load my custom models?
Please help me.

And merry christmas to all of you.

Thank you.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Fri Jan 08, 2010 3:26 pm 
Offline

Joined: Fri Dec 18, 2009 7:19 pm
Posts: 11
The model loading issue was solved.


But I got another doubt. How is the best way to implement a altimeter?

Given a position x,y,z a ray must be cast down on the Y axis until hit something. The distance between this object is your altitude. Right?

So, how can I do that?

thanks


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Mon Feb 01, 2010 9:17 am 
Offline

Joined: Sat Jan 17, 2009 10:51 am
Posts: 19
Hi, i'm having some troubles with the IDebugDraw.


here is the initialization code
Code:
      iDebugDraw = new JPCTDebugDraw(world, buffer);
      iDebugDraw.setDebugMode(DebugDrawModes.DRAW_WIREFRAME);
      dynamicWorld.setDebugDrawer(iDebugDraw);


called in the draw loop
Code:
                dynamicWorld.debugDrawWorld();


the implemented IDebugDraw
Code:
package jpctbullet;

import java.awt.Color;
import java.awt.Graphics;
import javax.vecmath.Vector3f;

import com.threed.jpct.*;

import com.bulletphysics.linearmath.IDebugDraw;
import com.bulletphysics.linearmath.VectorUtil;

public class JPCTDebugDraw extends IDebugDraw{
  private int _debugMode;
  private World _world;
  private FrameBuffer _buffer;
 
  private SimpleVector Vec3fToSVec(Vector3f vector)
  {
    // JPCT uses a inverted ZY axis and coordinates so flip them
    return new SimpleVector(vector.x, -vector.y, -vector.z);
  }
 
 
  public JPCTDebugDraw(World w, FrameBuffer b)
  {
    _world = w;
    _buffer = b;
  }
 
 
  public void setDebugMode(int debugMode)
  {
    _debugMode = debugMode;
  }
 
  public int getDebugMode()
  {
    return _debugMode;
  }
 
 
  public void drawLine(Vector3f from, Vector3f to, Vector3f color)
  {
    if(_debugMode > 0)
    {
      Camera cam = _world.getCamera();
      Graphics g = _buffer.getGraphics();
      Color lastColour = g.getColor();

      SimpleVector pointA = Interact2D.project3D2D(cam, _buffer, Vec3fToSVec(from));
      SimpleVector pointB = Interact2D.project3D2D(cam, _buffer, Vec3fToSVec(to));
     
      g.setColor(new Color(color.x, color.y, color.z));
     
      // do not know why, but some times pointB is null
      if(pointA != null && pointB != null){
        g.drawLine((int)pointA.x, (int)pointA.y, (int)pointB.x, (int)pointB.y);
      }
      g.setColor(lastColour);
    }
  }
 
 
  public void draw3dText(Vector3f location, String textString)
  {
    Camera cam = _world.getCamera();
    Graphics g = _buffer.getGraphics();
    SimpleVector loc = Interact2D.project3D2D(cam, _buffer, Vec3fToSVec(location));
   
    g.drawString(textString, (int)loc.x, (int)loc.y);
  }
 
 
  public void drawContactPoint(Vector3f pointOnB, Vector3f normalOnB, float distance, int lifeTime, Vector3f color)
  {
   
  }
 
 
  public void reportErrorWarning(String warningString)
  {
    System.out.println(warningString);
  }

}



It's not like the code doesn't do anything. I does. It draws RGB axis lines regardless of what I set it too. I would like to get it to work so I can see the wireframe rigid bodies.


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Sun Mar 21, 2010 3:32 am 
Offline

Joined: Sun Mar 21, 2010 3:30 am
Posts: 1
Hi, a little big question: is JBullet deterministic? has anyone test this? It was developed thinking about it or if I found jbullet acting in deterministic way is just a lucky shoot?
thanks for reply :mrgreen:


Top
 Profile  
 
 Post subject: Re: Java port of Bullet
PostPosted: Tue Jul 13, 2010 7:58 pm 
Offline

Joined: Tue Jul 13, 2010 7:52 pm
Posts: 9
I am trying to create a roulette game using jBullet for the spinning of the ball. I am not sure what collision shape to use for the wheel.

I chose ConvexHullShape and passed in the vertices of the model, however I am not sure I have done this part properly.
Code:
    ConvexShape staticScenario = new ConvexHullShape(ModelPhysics.getVertices3f(node));
    Transform startTransform = new Transform();
    startTransform.setIdentity();

    float mass = 0f;

    startTransform.origin.set(new Vector3f(0, 0, 0));

    RigidBodyConstructionInfo info = new RigidBodyConstructionInfo(mass, new DefaultMotionState(
      startTransform), staticScenario, new Vector3f(0, 0, 0));
    wheel = new RigidBody(info);
    wheel.setCollisionFlags(wheel.getCollisionFlags() | CollisionFlags.STATIC_OBJECT);
    dynamicsWorld.addRigidBody(wheel);


ModelPhysics.getVertices3f(node) just passes through all the nodes of my model and returns the vertices.

When I drop a ball into the model, it stops around 25 units on top of the floor and then proceeds to role/hover to the edge of the model and fall off. Why is the ball not touching the model surfaces?

Any help would be appreciated.

Thanks,
Dave


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 121 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group