Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 4 5 [6]
  ignore  |  Print  
  Java port of Bullet Physics Library  (Read 101467 times)
0 Members and 1 Guest are viewing this topic.
Offline gelerox

Junior Newbie





« Reply #150 - Posted 2009-12-25 18:07:41 »

The only Demo I found is 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.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
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:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
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?
1  
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.
Offline irreversible_kev

Junior Member





« Reply #151 - Posted 2009-12-26 00:21:13 »

Why is 4*3?

I haven't read any of the rest of this thread but I think the answer to that is:

Because you are putting floats (each of which are 4 bytes) into the ByteBuffer
Offline Souliloquy

Junior Newbie





« Reply #152 - Posted 2010-01-25 16:04:52 »

Anyone considered wrapping jBullet in a java PAL interface port?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JaydeRyu

Junior Newbie





« Reply #153 - Posted 2010-02-02 09:44:44 »

I don't like cross forum posting, but I tried over at bullet forums with no reply a couple of days ago. So I'm going to see if anyone here has a response Smiley


Hi, i'm having some troubles with the IDebugDraw.


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


called in the draw loop
1  
                dynamicWorld.debugDrawWorld();


the implemented IDebugDraw
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  
80  
81  
82  
83  
84  
85  
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. The fact that it does draw the RGB axis line means that at least my drawLine() method is working. Any ideas how I messed it up?
Offline normen

Junior Newbie





« Reply #154 - Posted 2010-04-01 16:29:42 »

Hi!

For jMonkeyEngine we are using jbullet and its a fantastic port, thank you!

As you might have noticed, the KinematicCharacterController has been updated in the latest native versions and we adapted the changes in our jbullet version (jump and gravity works now).  I already tried to contact you, jezek, via email but you never seem to answer Tongue

I have sent you the changes via email, if you did not receive it you can download a fixed version of KinematicCharacterController from our forums here.

Cheers,
Normen
Offline jezek2
« Reply #155 - Posted 2010-10-10 20:16:24 »

New version available on JBullet homepage.

Changes in release 20101010:
- Added KinematicCharacterController, GhostObject and CharacterDemo
- Added DbvtBroadphase
- Added serialization of BVH
- Updated most classes to match Bullet 2.72
- Added CCD motion clamping fix from Bullet 2.74
- Removed usage of interface calls
- Added stackless traversal in OptimizedBvh
- Added jumping/gravity to KinematicCharacterController (contributed by Normen Hansen)
Offline cowwoc

Senior Newbie




Java games rock!


« Reply #156 - Posted 2010-10-26 15:23:29 »

Hi Jezek2,

Why does TriangleMeshShape.calculateLocalInertia() contain
1  
assert (false);
? Are we never supposed to invoke this method? Smiley

Thanks,
Gili
Offline jezek2
« Reply #157 - Posted 2010-10-26 16:15:11 »

Hi Jezek2,

Why does TriangleMeshShape.calculateLocalInertia() contain
1  
assert (false);
? Are we never supposed to invoke this method? Smiley

TriangleMeshShape is only for static geometry, use GImpactMeshShape instead.
Offline cowwoc

Senior Newbie




Java games rock!


« Reply #158 - Posted 2010-10-26 22:46:31 »

TriangleMeshShape is only for static geometry, use GImpactMeshShape instead.

jezek2,

Please throw a descriptive exception instead of assert(false). For example:

throw new UnsupportedOperationException("TriangleMeshShape is only for static geometry, use GImpactMeshShape instead");

Gili
Offline stopwalve

Innocent Bystander





« Reply #159 - Posted 2010-11-12 19:11:39 »

Disregard ... wrong build of Beans.............

Sorry if this is a silly or something boneheaded on my part.  I downloaded the most recent JBullet jar. The Netbeans project fails to build and gives the following (thanks for any help, in advance) Smiley:
i


nit:
deps-clean:
Updating property file: E:\NetBeansProjects\jbullet-20101010\build\built-clean.properties
Deleting directory E:\NetBeansProjects\jbullet-20101010\build
clean:
init:
deps-jar:
Created dir: E:\NetBeansProjects\jbullet-20101010\build
Updating property file: E:\NetBeansProjects\jbullet-20101010\build\built-jar.properties
Created dir: E:\NetBeansProjects\jbullet-20101010\build\classes
Created dir: E:\NetBeansProjects\jbullet-20101010\build\empty
Compiling 255 source files to E:\NetBeansProjects\jbullet-20101010\build\classes
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\collision\narrowphase\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\util\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\collision\shapes\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\dynamics\constraintsolver\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\linearmath\convexhull\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\extras\gimpact\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\collision\dispatch\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\linearmath\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\dynamics\package-info.class
Creating empty E:\NetBeansProjects\jbullet-20101010\build\classes\com\bulletphysics\collision\broadphase\package-info.class
Copying 3 files to E:\NetBeansProjects\jbullet-20101010\build\classes
instrument-classes:
E:\NetBeansProjects\jbullet-20101010\build.xml:77:
java.lang.IllegalStateException: org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 69: java.lang.ClassNotFoundException: com.bulletphysics.dynamics.DiscreteDynamicsWorld$ClosestNotMeConvexResultCallback
        at cz.advel.stack.instrument.InstrumentMethod.visitEnd(InstrumentMethod.java:224)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at cz.advel.stack.instrument.Instrumenter.process(Instrumenter.java:119)
        at cz.advel.stack.instrument.InstrumentationTask.execute(InstrumentationTask.java:123)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:281)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)
Caused by: org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 69: java.lang.ClassNotFoundException: com.bulletphysics.dynamics.DiscreteDynamicsWorld$ClosestNotMeConvexResultCallback
        at org.objectweb.asm.tree.analysis.Analyzer.analyze(Unknown Source)
        at cz.advel.stack.instrument.InstrumentMethod.visitEnd(InstrumentMethod.java:99)
        ... 19 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.bulletphysics.dynamics.DiscreteDynamicsWorld$ClosestNotMeConvexResultCallback
        at org.objectweb.asm.tree.analysis.SimpleVerifier.getClass(Unknown Source)
        at org.objectweb.asm.tree.analysis.SimpleVerifier.isAssignableFrom(Unknown Source)
        at org.objectweb.asm.tree.analysis.SimpleVerifier.isSubTypeOf(Unknown Source)
        at org.objectweb.asm.tree.analysis.BasicVerifier.naryOperation(Unknown Source)
        at org.objectweb.asm.tree.analysis.Frame.execute(Unknown Source)
        ... 21 more
BUILD FAILED (total time: 18 seconds)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline i30817

Junior Member





« Reply #160 - Posted 2010-11-18 22:14:50 »

jezek2,

Please throw a descriptive exception instead of assert(false). For example:

throw new UnsupportedOperationException("TriangleMeshShape is only for static geometry, use GImpactMeshShape instead");

Gili

You can put descriptions on asserts too if you want to keep the "no runtime cost without -ea" feature.

for instance :
assert false : "the vm shouldn't get here";
Offline cowwoc

Senior Newbie




Java games rock!


« Reply #161 - Posted 2010-11-19 01:49:16 »

You can put descriptions on asserts too if you want to keep the "no runtime cost without -ea" feature.

for instance :
assert false : "the vm shouldn't get here";

i30817,

There is no runtime cost associated with throwing a normal exception in this case because the user is never supposed to invoke this method. An assert is simply not appropriate in this case.
Offline jezek2
« Reply #162 - Posted 2010-11-19 07:02:03 »

Good idea, the thing is that I've directly ported the asserts from C++ without too much thought. Descriptive exceptions would be much better and there is no cost as the methods are not normally called as pointed out.

Also thanks for reminding me that the asserts can have description, I've forgotten that. The thing is that I'm not fan of asserts, I prefer exceptions for everything as most obscure bugs are in production after months of flawless function without easy reproduce. Though in JBullet case there may be cases where it could be useful. Some internal errors were already noticed thanks to (Array)IndexOutOfBoundsExceptions. This is one of reasons for a port instead of binding, where in native side when there is such error the program crashes or even worse it continues with corrupted memory state.
Offline normen

Junior Newbie





« Reply #163 - Posted 2010-12-04 02:54:19 »

Hi Jezek,

I saw that you added the contributed Character class (it was actually by "SomethingNew" and not by me) but I did not receive any feedback when I contacted you so I have set up my own branch of your bullet port here. I sync it with your mtn version from time to time.

This branch is used in jMonkeyEngine3 for the physics simulation. It adds a HeightfieldTerrainShape contributed by the same guy and a maxForce parameter for the vehicle (as in the latest bullet version). If you care to add anything from this branch, its at your disposal.

Cheers,
Normen
Offline affogato

Innocent Bystander





« Reply #164 - Posted 2011-08-29 10:20:43 »

If anyone in the community is interested in using Translational Motors, the Spring Constraint (Generic6DofSpringConstraint) and the ConstraintDemo in JBullet, you can pull my fork of JBullet from:
https://github.com/affogato/JBullet-QIntBio-Fork

This was added for use in a cellular simulation project called QIntBio.

The spring constraint was added to Bullet _after_ the major refactoring of the constraint solver in revision 1542 involving SIMD support. The translational motor and the way the spring constraint uses it to simulate the effect of a spring, is written for the newer software design (with getInfo() functions and optimised SIMD functions).
Therefore, there was no code to solve the linear spring constraint, that can be ported in a straightforward manner.

New code was written following the old template.

Hope it is useful  Smiley
Offline andreas

Innocent Bystander





« Reply #165 - Posted 2012-07-30 18:49:48 »

Does your port support collada?

http://collada.org/mediawiki/index.php/Bullet_physics

/Andreas
Offline Estraven

Junior Newbie





« Reply #166 - Posted 2013-01-10 16:36:44 »

Hi everyone,

I hope there's still someone around this topic, cause I've a memory issue with JBullet.
It seems to generate a lot of " int[] " when calling DynamicWorld.stepSimulation.

I did profile the software using the JVisualMachine, it seems the memory leak is comming from com.bulletphysics.utils.Stacklist.<init>

I have no idea what is going on, the but garbage collector is running every 5 or 6 seconds to clean the mess, which cause my 3D app to freeze for half a second every 5 or 6 seconds.

Any idea ?

Estraven
Pages: 1 ... 4 5 [6]
  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.

Nickropheliac (16 views)
2014-08-31 22:59:12

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

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

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

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

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

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

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

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

BurntPizza (49 views)
2014-08-09 21:09:32
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!