Strafe and translation vectors in a 3d physics simulator

In summary, the conversation is about building a camera for a 3d physics simulator. The camera has inputs for modifying its pitch, yaw, roll, strafe, movement, and elevation. The rotation of the camera is stored in a quaternion and changes in pitch, yaw, and roll are stored in a Euler Vector. The translation vector is also present and needs to be translated into an actual vector. The proposed solution is to find the up-vector, left-vector, and front-vector of the quaternion and scale them accordingly. The conversation ends with the solution of creating a matrix from the quaternion to easily extract the up, left, and front vectors.
  • #1
_Nate_
20
0
I'm working on a 3d physics simulator, and I'm trying to build a nice, easy-to-use camera into it. Currently, the camera allows you to specify inputs that modify (among other things such as zoom) its pitch, yaw, roll, strafe, movement, and elevation.

The way it currently works is this: The rotation of the camera is stored in a quaternion. Changes in pitch, yaw, and roll are stored in a Euler Vector in the form (change in Pitch, change in Yaw, change in Roll). Every update, this rotation vector is converted to a unit quaternion and multiplied into the camera's quaternion. This data is used to transform the camera.

Now, I also have a translation vector in the form (change in Strafe, change in Elevation, change in Movement). I need to know how to translate this into an actual translation vector, in other words (delta x, delta y, delta z).

How do I do this?

My current idea is that I need to find the up-vector, the left-vector, and the front-vector of the quaternion, scale the up-vector by the elevation, the left-vector by the strafe, and the front-vector by the movement. If this is the best way, then how do I extract the up, left, and front vectors from a rotation quaternion?

Thank you.

Edit: solved. Found an easy way to get around doing all the math. For anyone in a similar position later, the way to do this is to create a matrix from the quaternion (if your quaternion does not already have this functionality, it is easy to achieve). The first three rows (or columns, depending on your implementation) represent the left, up, and front vectors respectively.
 
Last edited:
Physics news on Phys.org
  • #2
Thanks for telling us.
 

1. What are strafe and translation vectors in a 3d physics simulator?

Strafe and translation vectors are two important concepts in 3d physics simulators that determine the movement of objects in a 3d space. Strafe vectors refer to the lateral or sideways movement of an object, while translation vectors refer to the forward or backward movement of an object.

2. How do strafe and translation vectors affect the movement of objects in a 3d physics simulator?

Strafe and translation vectors determine the direction and speed of an object's movement in a 3d physics simulator. By modifying these vectors, the object's movement can be controlled and manipulated to simulate real-world physics and interactions.

3. Can strafe and translation vectors be applied to all types of objects in a 3d physics simulator?

Yes, strafe and translation vectors can be applied to all types of objects in a 3d physics simulator, as long as the object has a position and can move in three-dimensional space.

4. How are strafe and translation vectors calculated in a 3d physics simulator?

Strafe and translation vectors are calculated using mathematical formulas that take into account the object's position, velocity, and acceleration. These calculations are typically performed by the physics engine of the simulator.

5. Are there any limitations to using strafe and translation vectors in a 3d physics simulator?

While strafe and translation vectors are useful tools for simulating realistic movement in a 3d physics simulator, there are some limitations. These vectors do not take into account external forces or factors such as air resistance or friction, which may affect an object's movement in the real world.

Similar threads

Replies
1
Views
2K
Replies
1
Views
3K
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
340
Replies
3
Views
2K
Replies
10
Views
718
  • Classical Physics
Replies
10
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
Replies
1
Views
805
Replies
8
Views
3K
Back
Top