StaticPhysicsNode and collisions

Hi, I've this problem: it's a ball net game where the server compute the physics and sent to clients the current position of the ball.

The ball on server is a DynamicPhysicsNode and when it collide it makes sound. On the client I must make the ball as StaticPhysicsNode otherwise it conflict with the position set by server and ball become fuzzy.

With this StaticPhysicsNode I've seen that contatCallback are not detected and I cannot play sounds during collision.

What can I do?..


ContactCallback floorCollision = new ContactCallback() {
           public boolean adjustContact(PendingContact c) {

              System.out.println(c.getNode1().getName());
               System.out.println(c.getNode2().getName());

               if ((c.getNode1().getName().equals("floor") &&
                    c.getNode2().getName().equals("ball")) ||
                   (c.getNode1().getName().equals("ball") &&
                    c.getNode2().getName().equals("floor"))) {
                    // play sound
                  
                  
                   return true;
               }
               return false;
           }
       };
      
       physicsSpace.getContactCallbacks().add(floorCollision);



The nodes that collides are StaticPhysicsNode with setIsCollidable(true) and setActive(true).
the System.out.println... are never execute!

maybe the 2 nodes cannot collide becouse they are Static, so how can I do if I would that my ball on client make ONLY sound when collide (and not react dinamically).

p.s.: is correct to send always position of ball via network! or there's a batter way?? thanks
li7hium said:

What can I do?...

a) Make the ball a dynamic node on the client as well. or b) send collision event from server and switch off physics at client side completely (you don't need physics if you have static nodes only).
irrisor said:

li7hium said:

What can I do?...

a) Make the ball a dynamic node on the client as well. or b) send collision event from server and switch off physics at client side completely (you don't need physics if you have static nodes only).


with a dynamic node on the client it conflict with the position send by server...

I send every update the position of the ball to all clients, sending also the collision only for playng sounds can be heavy on performance?
li7hium said:

with a dynamic node on the client it conflict with the position send by server...

not necessarily. I have done exactly that in MultiShufflePuck as a kind of dead reckoning.

li7hium said:

I send every update the position of the ball to all clients, sending also the collision only for playng sounds can be heavy on performance?

Nn, I don't see why this should be a problem, as the traffic for collisions should be much lower than for constant position updates.