rotation
Introduction
Radians and Degrees
Shooting Entities From a Rotated Turret
// this might be in the Turret entity
public void ShootBullet()
{
var bullet = BulletFactory.CreateNew();
// Start the bullet on the turret
bullet.X = this.X;
bullet.Y = this.Y;
// Rotate the bullet so it faces forward
bullet.RotationZ = this.RotationZ;
// Move the bullet in the direction the turret is facing
// This code is written assuming that the turret is facing
// to the right when not rotated. If it is rotated, the Right
// property will adjust automatically.
bullet.Velocity = this.RotationMatrix.Right * BulletSpeed;
}Rotating a Sprite so it faces the cursor
Rotating the Shortest Angle
How to find the vertices of a Sprite
Last updated
Was this helpful?
