USING c# I'm new to unity game development, and im just wonder if I an get some help on a little project I'm try to get to work. I essentially want the NPC that is set to come to my position via NavMesh, to activate the idle animation when not moving and the walking animation when it decides to move. This is the simple quick follow script I have for the navmesh agent(the NPC), where it follows me. Obviously right now all it does it follow, it doesn't have animations rigged to it. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class FollowMe : MonoBehaviour { public NavMeshAgent enemy; public Transform Player; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { enemy.SetDestination(Player.position); } }
Computer Science
USING c#
I'm new to unity game development, and im just wonder if I an get some help on a little project I'm try to get to work. I essentially want the NPC that is set to come to my position via NavMesh, to activate the idle animation when not moving and the walking animation when it decides to move.
This is the simple quick follow script I have for the navmesh agent(the NPC), where it follows me. Obviously right now all it does it follow, it doesn't have animations rigged to it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class FollowMe : MonoBehaviour
{
public NavMeshAgent enemy;
public Transform Player;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
enemy.SetDestination(Player.position);
}
}
Trending now
This is a popular solution!
Step by step
Solved in 5 steps