Collision between 2 characters

Hi there,

I’m having a problem with the collision of 2 characters in my game. The condition are as follow:

  • Those two characters use CharacterControl as their physic controller.
  • One character (A) is controller by using keyboard and the other one (B) doesn’t move at all
  • Character A has one sword attached to its right hand. That sword is using RigidBodyControl in kinematic mode.
  • There are several boxes with RigidBodyControl in dynamic mode around the characters
  • When character B is sliced by character A’s sword, I switch its control to KinematicRagdollControl in ragdoll mode.

    The result I want is when character A move around and collides with character B, it treats character B as wall or obstacle. But instead of that, character A just move through character B as if there is nothing there. However, character A still collides with the other boxes as expected. Character B is also pushed a little when the sword collide with it. It seems that CharacterControl cannot have physical collision with other CharacterControl. Is there any way around that problem? or should I use RigidBodyControl for character B (later, I also need to control character B with keyboard)? I think there should be a way for characters to not passing through each other during the collision.

    Before, I had tried to use KinematicRagdollControl for character B from the beginning and simply turn on ragdoll mode when the collision with the sword occured. Collision between A and B works just fine (character A can even stand on top of B). But I thought RagdollCollisionListener doesn’t work well with KinematicRagdollControl. It’s hardly detect any collision from the sword (it always detects collision with the terrain, sometime it detect collision with character A, but never detect collision from the sword). That’s my reason to switch between CharacterControl and KinematicRagdollControl for character B.

    Thanks in advance

Try a forum search

You could add a GhostControl to each CharacterControl with the same collisionshape of the CharcterControl, and make it only collideable with another GhostControl that serves for this prupouse (check the collisions groups part).

About your second problem, that it was your previous solution, I can’t answer that, I just don’t know it.

Always try to make a forum search before. Every month or so this same question shows up again ^^

Thanks for the answer.

I’ve tried to make forum search and all it say is exactly like what you mentioned. Basically we have to write codes to handle that collision by ourselves. But, nobody have explain how to respond to that collision (sliding with each other or bumping or something like that).

in the past, I’ve tried to handle those kind of collisions (without physics) using jME2 and it involves a lot of complicated calculation. I can try to re-implement that code and adapt it to physics environment. But, why nobody in the jME3 development team includes an ‘official’ CharacterControl collision in jME3 release? I think almost every game need that kind of collision since usually there will be more than 1 character on the game (nobody want their characters to walk pass through each other). I think it’s better if jME3 developer make it rather than everyone of us try to make it ourselves. Not everybody have the required mathematical knowledge to create that calculation.

I remember that this is a bit complicated, involving both the jMonkey’s implementation of bullet and the official bullet. If some core member see this, maybe they can explain you the why.

Cause we are lazy :stuck_out_tongue: Bullets character is crap anyway, you’ll end up doing your own.

Edit: Seriously its because else they bump into ghost objects which is even more stupid than going through each other.

1 Like

Im also interrested in a solution to this problem. Has anyone an idea/trick/pointer-where-to-look? Im not that interrested in trail and terror me through this so id appriciate any pointers i could get? Can anyone confirm the ghostcontrol trick? I have “players” ghost control with collideGroup and collideWithGroup set to same value but still get no “reaction” - even though I MAY have set something up wrong. As ive gathered it, ghost controls can REPORT collisions with ridgid bodies / Character controls - but not be used to collision REACTIONS? So ghost <-> ghost collision would just generate an Event right?

Right now im using jbullet as i started to get issues with native bullet when i started to play with collision groups the other day.

PS. (prolly not relevant) I use a manually stepped PhysicsSpace (not added through BulletAppState but rather through physicsSpace.update/physicsSpace.distributeEvents up until max-all-participating-players-latest-action-timestamp ) as i simulate my physics on server and only use bulletappstate on client for prediction/looks. DS.

Hi everybody. I’ve done some forum / doc research too, but I just can’t find a definitive answer to this (apparently) easy problem.

The tutorials show how to elegantly handle character/level collisions (i.e. walking on a floor). It looks like there is no “standard” way to get two or more characters collide and not pass one through another.

What I’m looking for is: if a character bumps into another, it should stop moving or slide along the other character (depending on the direction / collisionshape).

I read about @mattm 's solution, that is adding two GhostControls to the character, make GhostControls only collide with other GhostControls using collision groups, and then manually handling the collisions. The problem is that this solution requires me to handle the “stopping or sliding” part, which i’d like to delegate to the underlying physics engine.

I can probably still live happy falling back to manually responding to the collision by stopping the character’s movement (hoping that since the last frame it didn’t already moved INTO another character), giving up the “sliding” part, but I’d like to know if there is a better solution that leverages the power of JMonkeyEngine and the Bullet integration.

I also tried to use RigidBodyControls in kinematic mode instead of GhostControls (they are attached to the same node the CharacterControl is attached to), but the engine simply reports a static-static collision and lets the characters move through each other.

This is IMHO a FAQ, but there seems to be no standard answer.

Can any one of you Uber Experts ™ enlighten us :wink: ?