Good evening,
I would like to know if it's possible to dynamically change a character's velocity, while he moves. The character would react like a car, with an acceleration and deceleration.
I tried overwriting the GoTo and GoToAsync method and implementing a mathamic formula, but with no success.
method GoTo (X,Y)
{
var d = Math.Sqrt(Math.Abs(Math.Pow((X-this.X),2))-Math.Abs(Math.Pow((Y-this.Y),2)));
this.GoToAsync(X,Y)
for (var i=0; i<=d; i=i+1) {
this.velocity = (270-270*Math.Exp(-i/2))-(270*Math.Exp((i-d)/2));
Sleep(d/270);
}
}
I even tried putting the GoTo/GoToAsync inside the cycle, but what I found out was that when you send the character to a X and Y, the character will move with his initial velocity until he gets to those points.
I don't want to use the DirectWalk because I want the characters to do bends.
Am I doing something wrong or since the char's velocity is constant it's impossible to add acceleration and deceleration ?