lol… I literally JUST finished integrating JBullet into my game engine. Good timing on the release. ;D
And THANK YOU for your hard work!
lol… I literally JUST finished integrating JBullet into my game engine. Good timing on the release. ;D
And THANK YOU for your hard work!
I’ve started using JBullet at my project at work. Great stuff!! I’ll be needing a way to navigate a character threw a static world though. So I’ll attempt to port the KinematicCharacterController sometime soon. Hopefully withing a few weeks.
I had a go at porting the KinematicCharacterController. It was more work than I expected as I also had to port GhostObect and related classes. I’ve got the CharacterDemo compiling and running without throwing exceptions. However the character falls threw the floor. So I’ve made some mistakes I’ll try to debug it tomorrow. I’ll keep you posted. Will probably beg for help soon
Btw, nice timing on the latest release. The KinematicCharacterController uses the convexSweepTest. So that saved me some work.
I’ve fixed some bugs and got the character walking around the bsp room. Seems to be working ok. Did not find a way to scale the bsp room, so it is a little bit different from the c++ version.
That’s great Can you send me your modifications to my e-mail?
For scaling I think it would be sufficient to just multiply the points (for ConvexHullShape) and Transform origins by scaling value. I didn’t port whole BSP loader because it was too much work and useless for demo purposes.
I’ve commited tom’s port of KinematicCharacterController, GhostObject and CharacterDemo.
Can the LWJGL libraries for the demos on the JBullet website be updated to include the Solaris 64-bit binaries?
Would it be possible to get another build out now since the Kinematic stuff has been added? I’ve tried downloading the source and building it myself, but the monotone repository is missing some of the dependencies.
Thanks. ;D
Well, jezek, it’s excellent work, thank you for it! I was thinking about creation some kind of simulation library for my project by myself, but port of Bullet most likely is preferable.
I make small demo, with box, bordered by 4 static planes, and several (7-10 is enough) bolls moving in it (billiard, you know). No friction, no gravity, DiscreteDynamicWorld, AxisSweep3 broadphase, SequentialImpulseConstraintSolver, and so on – mostly copied from your demos. And it shows quite strange behavior.
Energy ( =sum(m*v^2/2) ) does not conserve. Even not close to it. Every collision change total energy of system. For my expirements it’s constantly increase, so, after 5000 iterations or above energy increases about 30 times! Even if I decrease simulation step to 0.0001 and use rather small initial velocities (about 5-7m/s). I’ve noticed, what 1 ball, even with step 0.01 is rather stable in it, so errors seems to rooted in sphere-sphere collisions.
Although sphere-sphere and sphere-plane collisions are totally symmetric (forces are applied to mass center), and they was not given initial rotation (angular velocity), after collisions angular velocity tends to grow up. It means, angular momentum is also not conserve. I do not know, may be it’s known limitation of used algorithms, but it also may indicate some errors in it. Again, 1 ball is rather stable in it, so it seems to be a feature of sphere-sphere collisions.
It’s possible to load a custom model and use its mesh to run some simulations?
Thank you.
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.
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:
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?
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.
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
Anyone considered wrapping jBullet in a java PAL interface port?
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
Hi, i’m having some troubles with the IDebugDraw.
here is the initialization code
iDebugDraw = new JPCTDebugDraw(world, buffer);
iDebugDraw.setDebugMode(DebugDrawModes.DRAW_WIREFRAME);
dynamicWorld.setDebugDrawer(iDebugDraw);
called in the draw loop
dynamicWorld.debugDrawWorld();
the implemented IDebugDraw
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?
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
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
New version available on JBullet homepage.
Changes in release 20101010:
Hi Jezek2,
Why does TriangleMeshShape.calculateLocalInertia() contain
assert (false);
? Are we never supposed to invoke this method?
Thanks,
Gili
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
Disregard … wrong build of Beans…
[s]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) :):
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)[/s]