gelerox
Junior Newbie
|
 |
«
Reply #150 - Posted
2009-12-25 19: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.
|
|
|
|
|
irreversible_kev
|
 |
«
Reply #151 - Posted
2009-12-26 01: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
|
|
|
|
|
Souliloquy
Junior Newbie
|
 |
«
Reply #152 - Posted
2010-01-25 17:04:52 » |
|
Anyone considered wrapping jBullet in a java PAL interface port?
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
JaydeRyu
Junior Newbie
|
 |
«
Reply #153 - Posted
2010-02-02 10: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  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) { 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)); 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?
|
|
|
|
|
normen
Junior Newbie
|
 |
«
Reply #154 - Posted
2010-04-01 18: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  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
|
|
|
|
|
jezek2
|
 |
«
Reply #155 - Posted
2010-10-10 22: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)
|
|
|
|
|
cowwoc
Senior Newbie 
Java games rock!
|
 |
«
Reply #156 - Posted
2010-10-26 17:23:29 » |
|
Hi Jezek2, Why does TriangleMeshShape.calculateLocalInertia() contain ? Are we never supposed to invoke this method?  Thanks, Gili
|
|
|
|
|
jezek2
|
 |
«
Reply #157 - Posted
2010-10-26 18:15:11 » |
|
Hi Jezek2, Why does TriangleMeshShape.calculateLocalInertia() contain ? Are we never supposed to invoke this method?  TriangleMeshShape is only for static geometry, use GImpactMeshShape instead.
|
|
|
|
|
cowwoc
Senior Newbie 
Java games rock!
|
 |
«
Reply #158 - Posted
2010-10-27 00: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
|
|
|
|
|
stopwalve
|
 |
«
Reply #159 - Posted
2010-11-12 20: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) : 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!
|
|
i30817
|
 |
«
Reply #160 - Posted
2010-11-18 23: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";
|
|
|
|
|
cowwoc
Senior Newbie 
Java games rock!
|
 |
«
Reply #161 - Posted
2010-11-19 02: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.
|
|
|
|
|
jezek2
|
 |
«
Reply #162 - Posted
2010-11-19 08: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.
|
|
|
|
|
normen
Junior Newbie
|
 |
«
Reply #163 - Posted
2010-12-04 03: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
|
|
|
|
|
affogato
|
 |
«
Reply #164 - Posted
2011-08-29 12: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-ForkThis 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 
|
|
|
|
|
andreas
|
 |
«
Reply #165 - Posted
2012-07-30 20:49:48 » |
|
|
|
|
|
|
Estraven
|
 |
«
Reply #166 - Posted
2013-01-10 17: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
|
|
|
|
|
|