Hi,
I try to change the CollisionShape of BetterCharacterControl
The default one is CapsuleShape but for my player I want a more precise CollisionShape
So I made a MegaCharacterControl extends BetterCharacterControl
who override getShape() methode and replace the CapsuleShape. It works perfectly with BoxCollisionShape but when I try to use CollisionShapeFactory (to fit perfecty my player model) I get this error:
java.lang.IllegalArgumentException at com.jme3.scene.Geometry.setMesh(Geometry.java:193) at com.jme3.bullet.util.DebugShapeFactory.createDebugShape(DebugShapeFactory.java:116) at com.jme3.bullet.util.DebugShapeFactory.getDebugShape(DebugShapeFactory.java:85) at com.jme3.bullet.debug.BulletRigidBodyDebugControl.<init>(BulletRigidBodyDebugControl.java:60) at com.jme3.bullet.debug.BulletDebugAppState.updateRigidBodies(BulletDebugAppState.java:175) at com.jme3.bullet.debug.BulletDebugAppState.update(BulletDebugAppState.java:118) 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(Unknown Source)
I got the same error by using CompoundCollisionShape
Is there a way to make it works or did I need to use an other way to get a precise collision shape ?
my getShape() methode looks like this:
@Override
protected CollisionShape getShape()
{
CollisionShapeFactory collisionshape = CollisionShapeFactory.createMeshShape(playerModel);
CompoundCollisionShape compoundCollisionShape = new CompoundCollisionShape();
Vector3f addLocation = new Vector3f(0.0F, getFinalHeight() / 2.0F, 0.0F);
compoundCollisionShape.addChildShape(collisionshape, addLocation);
return compoundCollisionShape;
}