Collision between two PhysicsCharacterNode --Delayed

Hello,



I’ve got a 3D scene where two PhysicsCharacterNode are moving.



Sometimes, they meet each other. The problem is that one of the character is pushing the other into its own direction.

I need that a CharacterPhysicsNode can’t move another one.



Here is a picture I’ve taken of what I need :







I want the left character to make the top one to stop instead of being pushed.



Is there something in the PhysicsCharacterNode that can help with doing that ?



Thanks in advance

1 Like

Not that I know of, no.

Can’t we add a big weight to the characters so that they’re are very difficult to move or something like that ? Or add a flog saying that it can,t be affected by tohers ?

Otherwise I will need to detect collision between PhysicsCharacterNode my self and stop them manually I think :frowning:

Either that or you use kinematic physics nodes, of course the handling is different and its got no “character” jumping, walkdirection etc. stuff.

Ok, thanks.



I will try to do that.

Hello,

I tried to change part of my code :



[java]

//


//Calculate collision shape
//
BoundingBox box = ((BoundingBox)model.getWorldBound());
float xHalfExtent = box.getXExtent();
float yHalfExtent = box.getYExtent();
float zHalfExtent = box.getZExtent();
float radius = Math.max(xHalfExtent, zHalfExtent);
float height = yHalfExtent - radius;
CapsuleCollisionShape shape = new CapsuleCollisionShape( radius, height + 0.15f);

//
//Create physics node
//
this.physicNode = new PhysicsCharacterNode( shape, 0.01f );
physicNode.attachChild( model );
this.physicNode.setUpAxis(1);
this.physicNode.setGravity(10);
this.physicNode.setFallSpeed(10);
this.physicNode.setJumpSpeed(10);
this.physicNode.setMaxSlope( FastMath.PI / 2.0f );

//
// Place it at a random point - TODO
//
this.physicNode.setLocalTranslation( 10, 10, 10 );
[/java]

By :
[java]
//
//Calculate collision shape
//
BoundingBox box = ((BoundingBox)model.getWorldBound());
float xHalfExtent = box.getXExtent();
float yHalfExtent = box.getYExtent();
float zHalfExtent = box.getZExtent();
float radius = Math.max(xHalfExtent, zHalfExtent);
float height = yHalfExtent - radius;
CapsuleCollisionShape shape = new CapsuleCollisionShape( radius, height + 0.15f);

//
//Create physics node
//
this.physicNode = new PhysicsNode( model, shape, 0.1f);

//
// Place it at a random point - TODO
//
this.physicNode.setLocalTranslation( 10, 10, 10 );
[/java]

Well, It works ... a little too good.
Now my characters are considered as classic elements. So with a capsule shape.... they roll xD

** Test 1 :
I tried with a BoxCollisionShape but it's still not good.
Is there a way to have a PhysicsNode that always stays with the same Up axis ?

** Test 2 :
it tried to add :
[java]
this.physicNode.setKinematic( true );
[/java]
The object is nor rolling anymore but :
It doesn't move at all :(
- I have to put it in the exact coordinate I want it to be ( I can't let it fall from sky ). That's not a real problem, I just have to calculate the collision with the landscape before adding it.
- More worrisome, the method setLinearVelocity dosn't seem to work on Kinematic object. :(

Yes, as I said, kinematic nodes dont have the character methods, they are not affected by physics. You can move it around with setLocalTanslation(), the physics forces etc. will be calculated based on the amount of movement. As with the character node you will have to simulate gravity etc. in your own terms. Another way could be using a GhostNode and dong all collision etc. stuff youself.

Ok, for what I see there is many to simulate nodes I still don’t know.



I will play with the API for a littlle time :stuck_out_tongue:



Thanks for your answers.

Anyway why is it so important it dont move?

I’m making a tactical game.



Each pc has his actions and move. I want something fluid so I intended to use setLinearVelocity(…) instead of setWalkingDirection(…)

But kinematic element doesn’t seem to move with setLinearVelocity(…)

No, I told you it only works with setLocalTranslation…

Ok, So I won’t try to use Kinematic physics node for solving my problem. :slight_smile:



I will check if I can find something in the API that will enable me to use PhysicsNode or GhostNode.

Otherwise, I will intercept collision between PhysicsCharacterNode. :stuck_out_tongue:



Thank you for your answers.

I tag this problem on my todo list.