public void RotateZ(double radians) { Matrix3 m = new Matrix3(); m.SetRotateZ(radians); Set(this * m); }
// rotates x and y according to the Sin and Cos of the radian specified public void RotateZ(double zRadians) { Matrix3 rot = new Matrix3(); rot.SetRotateZ(zRadians); Set(this * rot); }
public void RotateZ(double radiansZ) { Matrix3 rotate = new Matrix3(); rotate.SetRotateZ(radiansZ); Set(this * rotate); }
// works out the objects rotation Matrix and then sets the rotation. // finally it calls UpdateAllTransforms for this and all child objects, public void Rotate(float radians) { Matrix3 m = new Matrix3(); m.SetRotateZ(radians); SetRotation(localTransform * m); UpdateAllTransforms(); }
void SetEuler(float pitch, float yaw, float roll) { Matrix3 x = new Matrix3(); Matrix3 y = new Matrix3(); Matrix3 z = new Matrix3(); x.SetRotateX(pitch); y.SetRotateY(yaw); z.SetRotateZ(roll); Set(z * y * x); }
public void SetEuler(float pitch, float yaw, float roll) { Matrix3 x = new Matrix3(); Matrix3 y = new Matrix3(); Matrix3 z = new Matrix3(); x.SetRotateX(pitch); y.SetRotateY(yaw); z.SetRotateZ(roll); // combine rotations in a specific order Set(z * y * x); }
// gets angles from origin points - more research to see how this is implemented public void SetEuler(float pitch, float yaw, float roll) { Matrix3 x = new Matrix3(); Matrix3 y = new Matrix3(); Matrix3 z = new Matrix3(); x.SetRotateX(pitch); y.SetRotateY(yaw); z.SetRotateZ(roll); // rotate in a certain order Set(z * y * x); }
static void Main(string[] args) { Matrix3 m3a = new Matrix3(); m3a.SetRotateX(3.98f); m3a.PrintMatrixToConsole(); Matrix3 m3c = new Matrix3(); m3c.SetRotateZ(9.62f); m3c.PrintMatrixToConsole(); Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! }
public void RotateZ(float rotation) { Matrix3 m = new Matrix3(); m.SetRotateZ(rotation); m = this * m; m1 = m.m1; m2 = m.m2; m3 = m.m3; m4 = m.m4; m5 = m.m5; m6 = m.m6; m7 = m.m7; m8 = m.m8; m9 = m.m9; }
// Sets the objects new rotation and then called up UpdateAllTransforms for this and all child objects, public void SetRotate(float radians) { localTransform.SetRotateZ(radians); UpdateAllTransforms(); }
// public void Rotate(float rotate, float speed, float deltaTime) public void Rotate(float radians) { Matrix3 m = new Matrix3(); m.SetRotateZ(radians); setRotation(localTransform * m); /* float rotate = GetRotation(); * * tankTranslation = new Matrix3(1.0f, 0.0f, transform.m3, * 0.0f, 1.0f, transform.m6, * 0.0f, 0.0f, 1.0f); * tankRotation = new Matrix3(); * Console.WriteLine("delta \n" + deltaTime + "\nrotate\n" + rotate); * tankRotation.SetRotateZ(deltaTime); * * * Matrix3 tankRotationTwo = new Matrix3(); * Console.WriteLine("delta \n" + deltaTime + "\nrotate\n" + rotate); * tankRotationTwo.SetRotateZ(rotate); * tankRotation = tankRotationTwo * tankRotation; * * Matrix3 mat = transform * tankRotation; * mat.m3 = transform.m3; * mat.m6 = transform.m6; * mat.m9 = 1; * transform = mat; * * UpdateGunTransform();*/ /*rotation += (rotate * DEG2RAD); * * tankTranslation = new Matrix3(1.0f, 0.0f, position.x, * 0.0f, 1.0f, position.y, * 0.0f, 0.0f, 1.0f); * tankRotation = new Matrix3(); * tankRotation.SetRotateZ(rotation * DEG2RAD); * * Console.WriteLine("tankRotation"); * Console.WriteLine(tankRotation.ToString()); * * Matrix3 mat = tankTranslation * tankRotation; * Vector3 newPos = mat * new Vector3(0, 0, 1) * speed * deltaTime; * * position = position + newPos; */ // Vector3 newPosGun = mat * new Vector3(0, 0, 1) * speed * deltaTime; // gunPosition = gunPosition + newPosGun; // gunPosition = gunPosition + gunPositionOffset; //Console.WriteLine("Rotation: " + rotation); //tankTranslation = new Matrix3(1.0f, 0.0f, position.x, // 0.0f, 1.0f, position.x, // 0.0f, 0.0f, position.z); //tankRotation = new Matrix3(); //tankRotation.SetRotateZ(rotation*DEG2RAD); // tankMatrix = tankTranslation * tankRotation; //position = position + movement * speed * deltaTime; //Matrix3 rotateMatrix = new Matrix3(); //rotateMatrix.SetRotateZ(rotate*speed*deltaTime); //tankMatrix = tankMatrix * rotateMatrix; //Vector3 newVec = new Vector3(tankMatrix.m3, tankMatrix.m6, tankMatrix.m9); //position = position.Cross(newVec);//* tankMatrix ; //Console.WriteLine("Matrix"); //Console.WriteLine(tankMatrix.ToString()); //Console.WriteLine("position"); //Console.WriteLine(position.ToString()); //gunPositionOffset = gunPositionOffset + movement * speed * deltaTime; }