CollisionShape and BetterCharacterControl

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:

	at com.jme3.scene.Geometry.setMesh(
	at com.jme3.bullet.util.DebugShapeFactory.createDebugShape(
	at com.jme3.bullet.util.DebugShapeFactory.getDebugShape(
	at com.jme3.bullet.debug.BulletRigidBodyDebugControl.<init>(
	at com.jme3.bullet.debug.BulletDebugAppState.updateRigidBodies(
	at com.jme3.bullet.debug.BulletDebugAppState.update(
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(
	at 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:

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;

You really don’t want to do this. There is a good reason for using a spherical shape. A smooth rounded sphere with no extrusions is very unlikely to get caught on any edges.

If the collision mesh is the same shape as your player any sort of flat surface can stick to a wall. Every time you try to pass a corner or run along side another object you will more than likely get stuck.

ok, but how can i need to smooth the edge of my collision shape :neutral_face:
i try too make some sort of shooter game so i need a precise hit box. Maybe it’s not the good way to achieve this.

If you need a hit collision check that doesn’t mean that the physics object to move your character has to be that shape… You might have noticed that in many shooters you can have your hand or weapon “stick inside” a wall but you can still shoot at that hand.

Indeed, i’ll try something else and post it here if it works :slight_smile: