Just create the shape after you scale the model. At least in jbullet scaling the collision shapes is not consistent so I removed the applying of collision shape scales to the debug geometries.
What’s wrong there? It creates a new vector anyway.
@normen said:
Just create the shape after you scale the model. At least in jbullet scaling the collision shapes is not consistent so I removed the applying of collision shape scales to the debug geometries.
I already tried it. If i scale before the shape creation, so the same effect.
The issue is that it scales the shape with a different value.It scales not 0.5f. It scales about 0.25f. I would appreciate if you check it.
Thats because you scale the root node. Either make the shape from the root node or scale the object you make the collision shape for. Do not scale the collision shapes.
@normen said:
Thats because you scale the root node. Either make the shape from the root node or scale the object you make the collision shape for. Do not scale the collision shapes.
But physics work ok. I can jump on scaled house or cube. The only issue is the debug shape is not the same shape as the physical object.
@mifth said:
But physics work ok. I can jump on scaled house or cube. The only issue is the debug shape is not the same shape as the physical object.
As I said, if I add the scaling again then spheres etc. won’t scale correctly in the debug display, theres a reason the applying of scale is commented out.
@normen said:
As I said, if I add the scaling again then spheres etc. won't scale correctly in the debug display, theres a reason the applying of scale is commented out.
Then you should to find the way how to solve the scaling issue for spheres and meshes. As the debugshape is in the mess. If i have many objects with a different scale - there will be real mess. Also, if scale>=2.0f , then my viewport will be in a mess of BIG debug shapes.
Old debug shape worked ok as far as i remember.
Another explanation ( @madjack the screen is for you too. Check my sys.out):
@normen said:
Use CollisionShapeFactory.createMeshShape, the mesh is not scaled, the geometry is.
I found one issue with CollisionShapeFactory class. The class makes exception if jme-terrain library is not added.
But i don’t use Terrain library in my game.
Here is the exception:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NoClassDefFoundError: com/jme3/terrain/geomipmap/TerrainQuad
at com.jme3.bullet.util.CollisionShapeFactory.createMeshShape(CollisionShapeFactory.java:164)
at com.pr.scene.PRSceneObject.testScene(PRSceneObject.java:117)
at com.pr.scene.PRSceneObject.(PRSceneObject.java:46)
at com.pr.main.PRGameManager.createScene(PRGameManager.java:36)
at com.pr.scene.PRSceneLoader.update(PRSceneLoader.java:72)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:287)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:239)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: com.jme3.terrain.geomipmap.TerrainQuad
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
… 11 more
Yeah, thats because it has to recognize terrain to be able to make HeightMapCollisionShapes. You can either just add the terrain libs (they are not exactly huge) or do the same as the CollisionShapeFactory does in your own class.
@normen said:
Yeah, thats because it has to recognize terrain to be able to make HeightMapCollisionShapes. You can either just add the terrain libs (they are not exactly huge) or do the same as the CollisionShapeFactory does in your own class.
Ok, thanks. Then i’ll add the lib to have the code up to date.