0
votes

So I know about collision groups and filters, etc. But I need a way on the server to check if the bullet came from the same player. If this was just on the client that would be easy because I could create a collision group for player's own bullets and one for enemy bullets, but since the server is the one detecting the collisions there's no "client" player and every player and bullet is treated the same, other than the user data attached to the bullet has a uid.

So basically I want something like this -

  if(collisionA.m_userData.type == "projectile"){
            if(collisionA.m_userData.uid === collisionB.m_userData.uid){
               dontApplyCollisionOrPhysics()
            }
        }
1
still haven't found a solutionjoe

1 Answers

0
votes

You could improve your bullet object by adding a property owner

function bullet(owner){
    //Your Bullet properties
    this.owner = owner;
}

You only create the object bullet when you are going to use it, so in that moment you add the owner. In this case, the uid.