Hi guys, please how do I make an actor rotate in the direction of movement
Actor has utility method to rotate it so it points a given point in world-space:
this.Actor.LookAt(Target.Position);
Please how can I make a chase player script without navmesh
Here is sth simple that should work:
public class ChaseScript : Script
{
public Actor Target;
public float Speed = 5.0f;
public override void OnUpdate()
{
// Chase the target
if (Target)
{
var targetPos = Target.Position;
Actor.Position = Vector3.Lerp(Actor.Position, targetPos, Speed * Time.DeltaTime);
Actor.LookAt(targetPos);
}
}
}
Add this script to the enemy and set the reference Target
to the player object to chase.
2 Likes