- Home /
How to make my badguy freeze when he hit me?
navmeshagent bad guy follows me. i want him to freeze if he touch a cube that hovers by my head. its a long cube and i can aim it where i want. but how to freeze the badguy when he touch my cube thingy? dis my code so far. its on my bad guy.
using UnityEngine; using System.Collections;
public class FallenAngelAI : MonoBehaviour {
void Update ()
{
}
// Update is called once per frame
public void OnCollisionEnter (Collision coll)
{
//view is the tag on my little cube thing
if (coll.gameObject.tag == "view")
{
Debug.Log ("yay");
//baddie.gameObject.
}
}
}
i know...i suk at OnCollisionEnter() but what code do i put instead. the tags are all right and the script is in the right place.
What do you mean by 'freeze'? Is not Nav$$anonymous$$eshAgent.Stop is what you are looking for?
kinda...how to start it back up again? is it fallenAngel.GetComponent ().$$anonymous$$ove (); i tryed and it says "no overload for method move takes 0 arguements"
$$anonymous$$aybe Nav$$anonymous$$eshAgent.Resume will help? C'mon, start reading documentation and not trying to guess what could work.
Answer by Gaming-Dudester · Apr 13, 2016 at 03:45 PM
wehlp. my code was right for the whole time but the tags werent right...i was sure they were but they werent somehow.
Your answer
Follow this Question
Related Questions
Scene does not work, no error, no crash? 1 Answer
,Enemy AI rapidfires and invokerepeating doesn't do anything. c# 1 Answer
All AI animations stop on first frame 0 Answers
AI Slowing Down Game 0 Answers
WebGL will not build, gets stuck at IL2CPP or asm.js, even with fresh Unity install and empty scene. 3 Answers