How do i make a colision with a specific object
I want for example a zombie when enters in colision with the character to make the value health to relative - it is my first time using unity... i used game maker and blender game engine and i need help
Have a look at OnTriggerEnter and OnCollisionEnter API docs.
Answer by Lord_Ford · Aug 23, 2015 at 09:25 PM
As @getyour411 posted what you are going to want is an OnTriggerEnter or an OnColliosionEnter function. You will preferably also want to 'tag' that particular game object (the Zombie). The code will look something like this:
void OnTriggerEnter (Collider other)
{
if(other.tag == "SOME_TAG")
{
-do something-
}
}
Make sure to check the unity DOCS, cheers! -PlayWell Studios
Answer by SQUARE-BADGER · Sep 16, 2015 at 08:15 PM
@Lord_Ford Thanks but now i have another problem! i want the zombie to detect the light and when a flashlight lights his face the zombie gain speed... the only problem is that i use visual scripting and the coding is like chinese to me...
Your answer
Follow this Question
Related Questions
Advance Colision Detection 1 Answer
Need a simple health script 1 Answer
How do I make an object that only passes through certain objects? 1 Answer
Death from collision 1 Answer
How would I go about making a spider create a web? 0 Answers