Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- timer += Speed * deltaTime;
- if (timer >= 1f)
- {
- Enabled = false;
- return;
- }
- float t = BackWard ? 1f - timer : timer;
- Vector2 currentBezier = bezierCurve.CalculatePoint(t);
- Vector3 newPosition = new Vector3(currentBezier.X, Transform.Position.Y, currentBezier.Y);
- Transform.Position = newPosition;
- Vector2 tangent = Tangent(t);
- Transform.Rotation = QuaternionUtils.LookAt(new Vector3(tangent.X, 0f, tangent.Y), Transform.Up);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement