- Home /
Question by
Shizzow · Jun 18, 2014 at 07:16 AM ·
oncontrollercolliderhit
OnControllerColliderHit how get
Hello guys, im wondering it is possible get information of that gameObject which i hitted
I mean i attached random information by the script on my gameObject which hits me, also i have alot same gameObjects with same tag, but with difference information. Its kinda hard to explain, but i hope u will understand, and help me. Also attaching script
private void OnControllerColliderHit(ControllerColliderHit col)
{
if (col.collider.gameObject.tag == "Bolt")
{
//How get information of gameObject with tag Bolt which hitted , Bolt gameobject have attacked script RandomInfo
call.myhealth();
}
}
Comment
Best Answer
Answer by Shizzow · Jun 18, 2014 at 08:38 AM
Solved private void OnControllerColliderHit(ControllerColliderHit col) {
if (col.collider.gameObject.tag == "Bolt")
{
///Grabing information from object which have tag "Bolt" Checking his componnets like my script is RandomInfo
randominfo = col.collider.gameObject.GetComponent<RandomInfo>();
player_name = randominfo.playerSend;
if (player_name != photonView.owner.name)
call.myhealth();
}
}
Your answer