public static CreateWorldTransformMatrix ( Vector3 &position, Vector3 &rotation, Vector3 &size, Matrix &matrix ) : void | ||
position | Vector3 | |
rotation | Vector3 | |
size | Vector3 | |
matrix | Matrix | |
return | void |
public override void Update(double elapsed) { rotation_velocity.X += (float)(input.RightThumbStick.Y * elapsed); rotation_velocity.Y += (float)(-input.RightThumbStick.X * elapsed); rotation_velocity.X *= 0.8f; rotation_velocity.Y *= 0.8f; rotation.X = MathHelper.Clamp(rotation.X + rotation_velocity.X, -MathHelper.PiOver2 * 0.95f, MathHelper.PiOver2 * 0.95f); rotation.Y += rotation_velocity.Y; rotation_matrix = Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationY(rotation.Y); velocity.X += (float)((rotation_matrix.Forward.X * input.LeftThumbStick.Y + rotation_matrix.Right.X * input.LeftThumbStick.X) * elapsed); velocity.Y += (float)((rotation_matrix.Forward.Y * input.LeftThumbStick.Y + rotation_matrix.Right.Y * input.LeftThumbStick.X) * elapsed); velocity.Z += (float)((rotation_matrix.Forward.Z * input.LeftThumbStick.Y + rotation_matrix.Right.Z * input.LeftThumbStick.X) * elapsed); velocity.X *= 0.8f; velocity.Y *= 0.8f; velocity.Z *= 0.8f; position.X += velocity.X; position.Y += velocity.Y; position.Z += velocity.Z; Entity.CreateWorldTransformMatrix(ref position, ref rotation, ref size, out world); }
public override void Update(double elapsed) { if (removed) { return; } float x, y; x = input.LeftThumbStick.X; y = input.LeftThumbStick.Y; if (Math.Abs(x) + Math.Abs(y) < Math.Abs(input.RightThumbStick.X) + Math.Abs(input.RightThumbStick.Y)) { x = input.RightThumbStick.X; y = input.RightThumbStick.Y; } velocity.X += (float)(x * elapsed * 10); velocity.Y += (float)(y * elapsed * 10); velocity.X *= 0.8f; velocity.Y *= 0.8f; position.X += velocity.X; position.Y += velocity.Y; Entity.CreateWorldTransformMatrix(ref position, ref rotation, ref size, out world); }
public override void Draw(GraphicsDevice device, Camera camera) { ModelRenderer modelrenderer = ModelRenderer.GetInstance(device); modelrenderer.Begin(camera, color); Matrix transform; Entity.CreateWorldTransformMatrix(ref position, ref rotation, ref size, out transform); modelrenderer.Add(model, ref transform); modelrenderer.End(); }
public override void Update(double elapsed) { Entity.CreateWorldTransformMatrix(ref position, ref rotation, ref size, out world); }