- Home /
Question by
opeca · Sep 25, 2013 at 06:12 PM ·
move an object
Increase speed in coroutine gives side-effect in movement
Hello All,
I have a coroutine which move an object in a specify direction.
When the speed is constant, the object arrives and stop as expected in the desired point. (position of another object).
But if I try to increase the speed inside the routine, the object moves away from the desired point on the same vector, but doesn't stop exactly on that point.
while (t < 1)
{
yield return null;
speed += 0.5f;
float g = Time.deltaTime*speed;
t += g;
MyGameObject.transform.Translate((end - start) * g);
}
Can somebody help to me please?
Thank you
Comment
Your answer
Follow this Question
Related Questions
Semi Dynamic Shadows 1 Answer
How to make object move to waypoints? 1 Answer
Following Mouse Motion 1 Answer
Move object with mouse without passing through colliders 0 Answers
C# trying to move a object 2 Answers