0
\$\begingroup\$

I made the camera position 10 units from an object, but not behind it. I dont want the camera position behind the object right away when it rotates, I want that when I will rotate the object, the camera position will move slowly until it will be behind the object.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Use a function that Interpolates between the two values such as MathHelper.Lerp or MathHelper.SmoothStep to smoothly rotate to the desired angle.

\$\endgroup\$
9
  • \$\begingroup\$ Are you looking from something along these lines? riemers.net/eng/Tutorials/XNA/Csharp/Series2/Camera_delay.php \$\endgroup\$ Commented Feb 13, 2012 at 17:14
  • \$\begingroup\$ but the camera is always behind the plane isnt it? \$\endgroup\$ Commented Feb 13, 2012 at 17:18
  • \$\begingroup\$ Directly no. The faster the plane is turning the more the camera will be offset from directly behind the plane and when it stops turning the camera will gradually return to directly behind it. \$\endgroup\$ Commented Feb 13, 2012 at 17:22
  • \$\begingroup\$ I didnt understand the Quaternion, what exactly is it, and what .Identity means? \$\endgroup\$ Commented Feb 13, 2012 at 17:44
  • \$\begingroup\$ Identity for Vectors, Matrices, and Quaternions is the value that causes nothing to happen if you multiply it (similar to the integer 1 EX: 4 * 1 is still 4). I'm not going to go into what a Quaternion is mathematically other than it is a powerful way to store rotational data. The Vector3.Transform bit is rotating the vector around the origin by the amount specified by the Quaternion. \$\endgroup\$ Commented Feb 13, 2012 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .