Bullet collider disabled with player
hi i'm scripting an online fps game with photon view cloud hosting but i don't know how to disable bullet collision only on my own character considering that the other players characters are clone of the first one with different istance
Answer by ChristianSimon · Mar 06, 2017 at 10:12 AM
Hi,
I guess that you are using PhotonNetwork.Instantiate(...) for instantiating a projectile. In this case you can use the PhotonView's isMine property and Unity's OnCollisionEnter callback. this can look like this:
public void OnCollisionEnter(Collision collision)
{
PhotonView pView = collision.gameObject.GetComponent<PhotonView>();
if (pView == null)
{
return;
}
// If you are using tags add a condition for that as well
if (pView.isMine)
{
return;
}
else
{
// Do damage
}
}
Your answer
Follow this Question
Related Questions
Trigger is not detecting tag 2 Answers
Photon Player And Weapon View Error 0 Answers
Steam VR - The correct way for setting up body and head colliders? 0 Answers
I have a gameobject with a box collider using c# how do i destroy it when the player touches it? 1 Answer
How to rotate Bullets alongside Gravity 2D (No RigidBody) 0 Answers