Hi!
I'm currently making a Dungeon Crawler-type game and I'm having a little bit of trouble with the movement of the character.
The way that it works right now is that I have an waypoint object which is moved around the game world using Raycast.
Moving the waypoint around like this works, moving the character to the waypoint has presented more of a challenge to me though. Looking up earlier answers I've found this script:
var target : Transform;
var speed = 5.0;
function Update ()
{
transform.position = Vector3.Lerp (
transform.position, target.position,
Time.deltaTime* speed);
}
While this script works in a way (it does move the character to the waypoint) it moves the character as if it was connected to the waypoint with a spring and as such moves faster the farther away you put the waypoint.
What I would like is to move the character at a constant speed toward the waypoint. Anyone got any idea how to achieve this?