Directions of the different Vector3 axes
Posted: Fri May 31, 2019 10:18 pm
Hi there!
I have just started using BEPUphysics v2 on a server for a game. The server runs on .NET Core 2.0 as a console application, and the game-client is made with Unity. During testing and exploring the demos, I have gotten very confused about which axes of positions in the engine corresponds to which direction (right, upwards and forwards). I think I have found that the X-axis of positions in the engine are in the Right direction, the Y-Axis is the forward direction and the Z-axis is the upwards direction. In the CharacterController Demo, the characters forward direction is stored in the Y-Axis. But I have also found some situations where it seems as if this is not true, such as in the RagdollDemo where the Y-Axis of the "gravity" parameter in DemoPoseIntegratorCallbacks is set to 10, which should mean that gravity pulls forwards (which it does not appear to do in the demo).
It also seems as if the AddRagdoll Method's "position" parameter uses the Y-axis as the upwards axis (taken from the Initialize Method):
The reason I am concerned about this is that Unity uses a left-handed coordinate system where X is the right-axis, Y is the upwards-axis and Z is the forward-axis, and I would like to synchronize positions between the server and the player.
I have just started using BEPUphysics v2 on a server for a game. The server runs on .NET Core 2.0 as a console application, and the game-client is made with Unity. During testing and exploring the demos, I have gotten very confused about which axes of positions in the engine corresponds to which direction (right, upwards and forwards). I think I have found that the X-axis of positions in the engine are in the Right direction, the Y-Axis is the forward direction and the Z-axis is the upwards direction. In the CharacterController Demo, the characters forward direction is stored in the Y-Axis. But I have also found some situations where it seems as if this is not true, such as in the RagdollDemo where the Y-Axis of the "gravity" parameter in DemoPoseIntegratorCallbacks is set to 10, which should mean that gravity pulls forwards (which it does not appear to do in the demo).
Code: Select all
Simulation = Simulation.Create(BufferPool, new SubgroupFilteredCallbacks { CollisionFilters = collisionFilters }, new DemoPoseIntegratorCallbacks(new Vector3(0, -10, 0)));
Code: Select all
int ragdollIndex = 0;
var spacing = new Vector3(2f, 3, 1);
int width = 8;
int height = 8;
int length = 8;
var origin = -0.5f * spacing * new Vector3(width, 0, length) + new Vector3(0, 0.2f, 0);
for (int i = 0; i < width; ++i)
{
for (int j = 0; j < height; ++j) <--- the 'j' variable runs along the height
{
for (int k = 0; k < length; ++k) 'j' is passed as the y parameter
{ \/
AddRagdoll(origin + spacing * new Vector3(i, j, k), Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), MathHelper.Pi * 0.05f), ragdollIndex++, collisionFilters, Simulation);
}
}
}