# Tagged Questions

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

1k views

### Using quaternions, how do I determine if an object is upside down from an original rotation?

Imagine this scenario: An object is laying flat on a horizontal surface, from this an original rotation is determined. Then the object is moved, and at some point flipped upside down and put back down ...
70 views

### camera panning problems with “modelviewer” camera

I have a camera that rotates around a center point using a rotation matrix and radius for the zoom from the object. I need to add right mouse button panning in. Here is the problem: when I change ...
230 views

### How do I ADD gravitation to a rotation matrix?

I have ported the Matlab script from https://instruct1.cit.cornell.edu/courses/bionb441/LSystem/ to POV-Ray and everything works fine (although I'm not quite sure why). To navigate a "turtle" through ...
382 views

### Why do these quaterion multiplications produce different results?

I am trying to use quaterions to modify the camera direction vector. This code works perfectly: glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x * mouse_sens * time_step), ...
916 views

### Translate extrinsic rotations to intrinsic rotations ( Euler angles )

The problem I have is very frustrating: I am using the Jitter Physics library which gives Quaternion rotations, you can extract the extrinsic rotations but I need intrinsic rotations to rotate in ...
1k views

### Need to translate a Rotation Matrix to Rotation y, x, z OpenGL & Jitter for 3D Game

I am using the Jitter Physics engine which gives a rotation matrix: M11 M12 M13 M21 M22 M23 M21 M32 M33 And I need it so OpenGL can use it for rotation GL.Rotate(xr, 1, 0, 0) GL.Rotate(yr, 0, 1, 0)...
5k views

### Rotate image around a specified origin

I'm trying to rotate my Turret.png (small Gunhead with a laser in front) towards the mouses location on the screen. I tried just using my method for rotating projectiles towards the next step on their ...
22k views

### Unity3D Orbit around orbiting object (transform.RotateAround)

The best way to explain this is I'm attempting to make a small model solar system (not to scale or anything complicated, just simple rotation as a learning exercise). There's a sun, a planet, and that ...
2k views

### “Align” a rotation to a direction

Good day all. I have a 3d object with a random rotation. I can express that object's rotation both through a quaternion or through an euler rotation. Then I have a vector3 normal that I get from a ...
38k views

### Rotate an object smoothly on the Y axis in Unity

I am attempting a simple script to swing a door open in Unity. This requires a smooth rotation of 90 degrees around the Y axis. I have seen that one way to do this is using Unity's Quanternion ...
55 views

### Tetris-like wall-kicking not working [duplicate]

So I'm making a falling-block puzzle game. It's not a Tetris clone, but the block clusters move in a similar fashion. I want to make it so that if you rotate against a wall, or against another piece,...
243 views

### Orbiting a camera around the Y axis whilst remaining up

I've been having difficulty with a problem which I thought was going to be a simple solution. I have a camera facing downwards on a character. The can camera be lowered and when it's lowered it ...
283 views

### How do I find the rotation point given a touch anchor, new position and new rotation?

I've got an Cocos2d layer which anchorPoint, position and rotation (according to http://www.qcmat.com/understanding-anchorpoint-in-cocos2d/) vary when the pinch zoom gestures. Everything works fine. ...
328 views

### get the new vertices after rotating in JOGL

I had rotate an object with openGL (JOGL). Is there a simply way how I can get the new vertices?
247 views

### Getting mousemovement despite mouselock - unity

I have lockcursor so the cursor doesn't leave the screen, but now i have to rotate an object based on mouse movement (think garrys mod item rotation) but the mouse cursor is obviusly locked to the ...
537 views

### Jittery Movement, Uncontrollably Rotating + Front of Sprite?

So I've been looking around to try and figure out how I make my sprite face my mouse. So far the sprite moves to where my mouse is by some vector math. Now I'd like it to rotate and face the mouse as ...
134 views

### Rotate view matrix based on touch coordinates

I'm working on an Android game where I need to rotate the camera around the origin based on the user dragging their finger. My view matrix has initial position of sitting on the negative z and facing ...
1k views

### How do I simulate a swinging pendulum?

I want to simulate a rope with a weight attached, swinging back and forth like a pendulum. Any actual physics is overkill; it's just endlessly repeating the same motion. JQuery has a the "swing" ease ...
270 views

### Rotations and Origins

I was hoping someone could explain to me, or help me understand, the math behind rotations and origins. I'm working on a little top down space sim and I can rotate my ship just how I want it. Now, ...
194 views

### Finetuning movement based on gradual rotation towards a target [duplicate]

I have an object which moves towards a target destination by gradually adjusting its facing while moving forwards. If the target destination is in a "blind spot", then the object is incapable of ...
148 views

### Finding the shorter turning direction towards a target

I'm trying to implement a type of movement where the object gradually faces the target. The problem I've run into is figuring out which turning direction is faster. The following code works until the ...
2k views

### Problem using glm::lookat

I am trying to rotate a sprite so it is always facing a 3D camera. Object GLfloat vertexData[] = { // X Y Z U V 0.0f, 0.8f, 0.0f, 0.5f, 1.0f, -0.8f,-0.8f, 0.0f, 0....
247 views

### Rotate 2d sprite towards pointer

I'm using Crafty.js and am trying to point a sprite towards the mouse pointer. I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under ...
429 views

### Rubik's cube array rotation

I'm about to make a 3D Rubik's cube based game in Flash AS3 and Away3d. I don't really know how to manage the 2D arrays of the Rubik's cube. For example, how do I rotate the corresponding arrays if ...
3k views

### How do you rotate a material 90 degrees in UDK?

So, I have started checking out UDK since yesterday, and most of it is clear and understandable. I'm trying to create a curved road. The idea was to use a brush (Curved Staircase) and set the steps ...
880 views

### Is this Rotation Matrix correct?

I'm having heavly troubles with setting up a View Matrix and a Projection Matrix. It simply doesnt work. So I think my problem is related to my rotationMatrix function. I'm using this tutorial to ...
344 views

### Rotating each quad in a batch separately?

Background In my app I use the following code to rotate my quad: Code //Rotate the quad Matrix.setIdentityM(mRotationMatrix, 0); Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f); ...
120 views

### Type of 3D Rotation Animation used in this video [closed]

http://youtu.be/IUZqinlhono I have referred to an application for interactive rotation in 3D space. The same is uploaded on youtube for your reference. I am having difficulty in understanding the ...
102 views

### Normals not rotated correctly

While rendering a cube to the gbuffer (diffuse, normal, depth) I noticed something odd when applying rotations. I build a world matrix for the cube as follows: Yaw = Yaw % MathUtil.PI2; Pitch = Pitch ...
5k views

### How to smoothly rotate a vector in a direction?

I'm looking for an easy way to achieve the following: Object A, B { Vector2D position; Vector2D orientation; } update(elapsed) { //rotate A's orientation in B's direction by x * elapsed ...
676 views

### Move parent according to child axis in Unity?

Can I ask my parent to move according to the child axis? This means if I turn right, then right again, the parent has to be at 180° from its original position, and not only at 90° (because "Right" ...
359 views

### Matrix represents same rotation with different euler angles

I have Transform component storing it's rotation as Quaternion. Transform has set/getEulerAngles (rotation order oy, ox, oz). I want to rotate object in any direction but while testing I get jumping(...
238 views

### How to make camera rotation independent from frame rate?

I multiply the mouse movement by a given number to get camera rotation of a desired speed. But it only works at 60 FPS. When I don't limit the frame rate I get around 350 FPS and the camera rotation ...
352 views

### How to set object's / node's absolute rotation correctly?

Usually when I want to rotate an object/node in my Ogre scene I call the node's rotate() method. That rotates the node locally relative to it's current rotation. So for example, when I start with 0 ...
248 views

### How to map absolute Joystick position to object rotation?

In my (Ogre) 3d scene I have an object that should be rotated locally based on Joystick input. I have a Joystick with min/max values of [-32767, 32767] on both X and Y axes. When the Joystick is in ...
138 views

### Getting Rotation Values From A Rotation Matrix

I'm trying to get rotation values along the x, y and z axis from a matrix that can include rotation, translation and scale data. Currently I have this function to return the y rotational value: float ...
692 views

### Mouse Aiming Causing Rotation Jitter

When our game's ships move around, mouse aiming causes them to shake around a lot. The body being aimed is moved kinematically. I think we've narrowed it down to this block of mouse tracking code. ...
511 views

### XNA - 2D Rotation of an object to a selected direction

I'm trying to figure out the best way of rotating an object towards the directional input of the user. I'm attempting to mimic making turns on ice skates. For instance, if the player is moving right ...
943 views

### iOS OpenGL ES 2.0 How to Billboard on Sphere and Rotate with Sphere

I have a sphere (earth) in OpenGL ES 2.0 for iOS. I also have markers that I want to place at lat/lons on the earth - but I want the markers to always face the user ( billboards ) but also move with ...
677 views

### How do I make an arrow line up with a bow when rotating them?

I am trying to create a bow and arrow animation in which the player can drag downwards to increase the bow strength (see the image) and release it to hit a target. I can't get the arrow to align with ...
500 views

### Sprite not rotating around its centre after Scaling at its centre

If I scale a sprite at its centre, then try to rotate it around its centre as well, the rotation does not occur around its centre. If you need to rotate, for example a scaled ball,the way its working ...
153 views

### Rotation independent rotation

I came up with some cube rotating, but I could not make it smooth and easy to use because as the cube turned - the keys that handle the turning changed their purpose. Link to demo. The demo rotation ...
872 views

### Weapon as camera's child, rotation messed up

I put my weapon as a camera child, it works, but when i rotate my player it seems the weapon rotate a little too. I'll attach some images so you can see it. As you can see, when i look up i ...
4k views

### Libgdx sprite rotation (image quality)

This one is probably really simple but I didn't find a solution. I'm trying to create a widget (speedometer) with libgdx. For the arrows I'm using the setRotation() function. But when the image is ...
2k views

### How to I rotate a triangle by dragging the mouse in libGDX?

More specifically, I have rotation working in a way I don't like as follows: //Draw the triangle using this draw method //batch.draw(texture, x, y, ...
282 views

### How to rotate one object around another moving object in 3-d?

i was wondering if anyone could give me some advice on how to rotate one object around another moving object. After a bit of googling i found some code on another website that worked perfectly but it ...
698 views

### Love2D : Problem rotating image in a SpriteBatch

I'm working on a falling blocks type of game with triangular pieces. I'm using a SpriteBatch to accumulate and remember the pieces and their locations. The problem is that when I rotate a scaled ...
5k views

### How to avoid gimbal lock

I am trying to write code with rotates an object. I implemented it as: Rotation about X-axis is given by the amount of change in y coordinates of a mouse and Rotation about Y-axis is given by the ...