Questions tagged [rotation]

Rotation is the circular movement of an object around a specific axis.

One of the primary forms of movement transformation on an object in space, alongside translation and reflection.

In games, especially 2D games, rotation can provide a lot of complexity in comparison to translation and reflection. For example, in collision detection, rotation does not guarantee the same borders and hitbox that are preserved in the other methods. Questions under the purview of this tag include all manner of scenarios dealing with the consequences of rotating an object in space.

Not to be confused with other definitions of rotation, such as "rotating through a roster of units".

1177 questions
7
votes
3 answers

Tetris : Effective rotation

I rotate each piece by rotation formula. More detail, because rotation angle is 90 so : xNew = y; yNew = -x; But my method has met two problems : 1) Out of box : each type of pieces is fit in square 4x4. (0,0 at under left) But by this rotation,…
hqt
  • 309
  • 5
  • 12
1
vote
1 answer

Find out which way to rotate based on current rotation and final rotation

I have one object that I want to rotate to a certain angle with 'smooth' rotation. I looked up on how to solve that and I came up with this: But how do I know in what way to rotate, positive or negative? According the the picture on ex. 1, I need…
Doodlemeat
  • 153
  • 6
1
vote
1 answer

CW/CCW Rotation of a Vector

Considering that I have a vector A, and after an arbitrary rotation I get vector B. I want to use this rotation operation in others vectors as well, but I'm having problems in doing that. My idea do that is to calculate the perpendicular vector C of…
user23132
  • 11
  • 2
1
vote
4 answers

Rotate Sprite towards another sprite

I have a Sprite class like this: class Sprite { double rotation ; // in degrees 0-360 double x; double y; } I'd like to have one sprite to rotate to another point with a constant rotation rate, the sprite should not rotate directly but mor…
Raildex
  • 751
  • 4
  • 26
1
vote
3 answers

How to rotate a whole rectangle by an arbitrary angle around the origin using a transformation matrix?

Suppose, I have a rectangle ABCD. Where, A(0,0), B(7,0), C(7,5) and D(0,5). I want to rotate the whole rectangle by theta = 50°. I know that, a rotation transformation matrix can be used to do that. So, I have done the following: A' = [0 0 1]…
user15743
0
votes
2 answers

Rotate can I rotate an object to a target angle using Euler Angles?

How do I rotate an object from its current angle to the desired angle in increments on 1 axis? The problem is the wraparound at 360 degrees What I have so far (Note: pseudocode): double MaxSpeed = 5; double CurrentAngle = -170; double…
JPtheK9
  • 2,031
  • 2
  • 14
  • 32
0
votes
1 answer

In Unity, why does a positive Z-axis rotation goes counter-clockwise while X and Y rotations go clockwise?

In Unity: With a perspective having Y and Z axes pointing up and right respectively, if I make a positive X rotation, the object rotates clockwise With a perspective having Z and X axes pointing up and right respectively, if I make a positive Y…
Raymond Pang
  • 101
  • 2
0
votes
1 answer

How to compute the origin/pivot point of objects in a hierarchy

I'm sorry if the title is bad, but i'll try my best to explain my problem. Consider a simple hierarchy of objects (Object1 -> Object2 -> Object3) If i now were to rotate Object1 by 45 degrees in the x axis, i believe Object2 and Object3 should also…
Suic
  • 119
  • 6
0
votes
0 answers

How do I rotate shoulder bone up and down using Rotate and Space.World independend on model orientation

I wanted to move my character's arms up and down in a straight way. The Rotation Gizmo tool can do exactely that. Playing with the wheel of the Rotation Gizmo tool in the attached screenshot (marked with red arrows in my screenshot), I could move…
tmighty
  • 919
  • 13
  • 38
0
votes
1 answer

How do I get a relative rotation between two positions?

For example, I have two objects: a & b. a's position is 12, 16, -2 and b's position is 14, 16, -3 I need to know how to find a relative rotation between them. By relative rotation I mean this: a's pitch and yaw so a is looking at b. I have no…
Nekoseri
  • 1
  • 2
0
votes
1 answer

How to eliminate roll rotation?

Let's say I have Rotation(0, 0, 180) [pitch, yaw, roll]. How to do it that I would have Rotation(180, 180, 0) which is exactly the same?
0
votes
1 answer

Rotating the playing field. (MonoGame)

My maths isn't as good as it should be, I need to pick up some reference books on Trig. Could someone give me an idea of the maths if I wanted to revolve many sprites around a central point? It's a 2D system in MonoGame. I'm going to try to describe…
0
votes
2 answers

XNA Rotating a Rectangle?

I am in the process of making a giant shooter game and I have got to the point where I needed to use rectangles to detect bullets and giants hitting the player. I did that however, if you look at this image: It shows the giant and the players…
Hash One
  • 1
  • 1
  • 1
-1
votes
1 answer

Rotation and Velocity vectors

I've looked through the suggested, but I can't see exactly what I need. I want to calculate the vector needed for forward motion of a rotated sprite. At the moment I have: sprite.Rotation = 0 sprite.Velocity = New Vector2(0,…
-1
votes
3 answers

Changing the central point for transform

I'm trying to rotate all sprites in the view port around a central character. I have made some progress, using the following I can get my ship to rotate around the coordinates 0,0, with the radius being the initial placement of the ship. How do I…