Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Killing other players by touching them

$
0
0
hello i am working on a multiplayer fisrt person tag game, where the hunter kill the other by touching them (actually would be better if the hunter kills if the player clicks on the mouse while is touching other players but first thing first) well the problem is i am failing in killing the other players for now i try 2 methods: function OnControllerColliderHit ( quem : ControllerColliderHit) { var nome = ""; nome = quem.gameObject.name; //soldier=gameObject.GetComponent("CharacterController"); if (nome == "soldier(Clone)" ) { //if ( Input.GetMouseButtonDown(0)){ Network.Destroy(soldier); //} } } this one like i said was supposed to kill the other player (spldier) when he is touched by the hunter. function OnTriggerEnter( quem : Collider) { var nome = ""; nome = quem.gameObject.name; if (nome == "soldier(Clone)" ) { //if ( Input.GetMouseButtonDown(0)){ Network.Destroy(soldier); //} } } and this one where i created a cylinder object and put it on the hunter prefab as a trigger, when the soldier gets in the thrigger he shoud die. both of the methods are not working can someone help me on this one?

Viewing all articles
Browse latest Browse all 171066

Trending Articles