Problems with CaspuleCollisionShape

Hello!



I’m currently working on an 3rd person character and I’m using the charactercontrol with CapsuleCollisionShape for it.



unforunately, sometime it “sinks” in other objects (like cubes), if I’m walking on them. That makes it impossible to jump.



Did you have similar problems? What could be the problem?



Here’s an extract of my Code (if everything looks fine, I post the whole code):



playerNode = new Node();

model = createModel(); //create the model for the player

playerNode.attachChild(model); //attach model to playerNode

characterControl = createCharacterControl();

playerNode.addControl(characterControl);

bulletAppState.getPhysicsSpace().add(playerNode);







protected CharacterControl createCharacterControl(){

CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(PlayerGlobals.CAPSULE_RADIUS, PlayerGlobals.CAPSULE_HEIGHT, 1);

CharacterControl characterControl = new CharacterControl(capsuleShape,0.05f);

characterControl.setJumpSpeed(PlayerGlobals.JUMP_SPEED);

characterControl.setFallSpeed(PlayerGlobals.FALL_SPEED);

characterControl.setGravity(PlayerGlobals.GRAVITY);

return characterControl;

}

Perhaps ur radius is small compared to the triangles of the cube? Also try changing the step height of the character control.

Alyo happens when you move it into the floor with the walkDirection.

Hello!



For walk direction I use the camera direction, but I set the Y value to zero. So I don’t think the problem is, that I walk “down”

post a screenshot with the debug shapes. Im sure your triangles for the cube are too big

I would agree with that in the second screenshot, but not in the first one. Is the Cube on Picture 1 too big to handle the capsule shape collision?



http://imgur.com/EUx3z,1lEVn#0

http://imgur.com/EUx3z,1lEVn#1

yes the second one is definitely way too big!!!, the first one seems ok, what are the extents? I think bullet recommends triangles between 0.1 - 4m (made these numbers up). But i had problems even that high with the character control, other physics worked alright. For character control, I would try keep them < 1m.



Also as suggested try changing the step height of the character control

I changed the collisionShape of the boxes:



I used BoxCollisionShape for the boxes first, now I tried CollisionShapeFactory.createMeshShape(geom);



it works better altough it’s not perfect (some times it glitches/struggles a little bit, but it’s ok for now)



Anyone else got bad experience with BoxCollisionShape?

You used a box for the character? Thats not a good idea, no.