private void UpdateTransform() { // ortho basis vec3 tangent, binormal; Geometry.OrthoBasis(vec3.UP, out tangent, out binormal); // decompose transformation position = node.WorldPosition - zAxis * (collisionHeight + 2.0f * CollisionRadius); direction = MathLib.Normalize(new vec3(-node.WorldTransform.AxisZ)); // decompose direction // in this case don't use properties phiAngle = MathLib.Atan2(MathLib.Dot(direction, tangent), MathLib.Dot(direction, binormal)) * MathLib.RAD2DEG; thetaAngle = MathLib.Acos(MathLib.Clamp(MathLib.Dot(direction, vec3.UP), -1.0f, 1.0f)) * MathLib.RAD2DEG - 90.0f; // object transformation playerBody.WorldTransform = GetBodyTransform(); // set camera camera.Modelview = GetModelview(); }