public void SetViewDirection(vec3 view) { direction = MathLib.Normalize(view); vec3 tangent, binormal; Geometry.OrthoBasis(vec3.UP, out tangent, out binormal); phiAngle = MathLib.Atan2(MathLib.Dot(direction, tangent), MathLib.Dot(direction, binormal)) * MathLib.RAD2DEG; FlushTransform(); }
private void UpdateTransform() { var up = vec3.UP; vec3 tangent, binormal; Geometry.OrthoBasis(up, out tangent, out binormal); position = node.WorldTransform.GetColumn3(3); direction = MathLib.Normalize(new vec3(node.WorldTransform.GetColumn3(1))); phiAngle = MathLib.Atan2(MathLib.Dot(direction, tangent), MathLib.Dot(direction, binormal)) * MathLib.RAD2DEG; objectDummy.WorldTransform = GetBodyTransform(); }
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(); }