# Tagged Questions

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

699 views

### Tetris: 2D Rotation Matrix?

I'm creating a Tetris clone right now. I've got the tiles of tetromino stored as an std::array<tile, 4>. Each tile holds its (x,y) coordinates relative to the piece. For example, the t-block is: ...
107 views

### Euler adjustments between two quaternions

I have two quaternions, q1 and q2. If my object's current rotation is at q1, but I need to get it to q2, what would be the process to figure out how much rotation I apply to x, y, and z in order to ...
20 views

### Child object looktowards waypoint

hi guys how can I let my child character looktowards upcoming waypoint which can be on curve,slopes,hill.I have tried sevaral scripts but they are not giving proper rotation across all direction.Most ...
76 views

### Rotating kinematic object around a moving point Box2D

I'm new at Box2D and I am making a simple game where you control the rotation of the maze and the gravity leads the ball to the exit. The game looks like: The problem: I want to rotate the maze, ...
161 views

### How can I adjust steer angle based on speed in Unity?

I'm following this (https://www.youtube.com/watch?v=kAEpLX3rfms) video on how to make a car in Unity. But my car doesn't lower the steering angle based on the speed of the video. The idea was that you ...
230 views

### smoothly recenter view over time

I'm currently using the Google Cardboard SDK for Unity to build a fighter pilot simulator. What I'm currently trying to do is recenter the view(CardboardHead) smoothly over time when the user looks ...
56 views

### Libgdx RotateToAction does not directly rotate between 179 and -179

It took me a bit of debugging to realize why I'm having trouble with my rotations and it seems that rather than just moving the 2 degrees between 179 and -179, it prefers to rotate all the way in the ...
55 views

### In unity, how do I rotate a vector in relation to the player?

I am making a radar script in a unity FPS game project I am making for class. I already have a working example of a radar script that works in relation to the player's position. However the rotation ...
290 views

### Unity3d - Transform rotation(angle) help

Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right. Here's the part of the code which controls the rotation: ...
58 views

### Camera rotation according to target direction

I am facing issue when camera is following to my target and target rotates to 90 degree or -90 degree than camera is not rotating.i want smooth rotation according to target when target is change the ...
129 views

### Given a 3d goal point and a turn rate in radius, find max speed to reach goal

I'm working on a 3d space sim with AI agents flying ships through space. I am trying to get them to follow a waypoint path nicely, which involves figuring out how fast they can be travelling and still ...
44 views

### Rotation of rectangles offsets render position

I have an unknown number "Bricks" that must follow a straight, but not always level, path. Each brick is rotated around one central point properly to form a shape of intersecting paths. My problem ...
38 views

It is possible to flip VBOs horizontally and vertically by swapping around destination coordinates. Is it possible to rotate an image by any angle, such as 45 degrees, using different destination ...
289 views

### Rotate arrow without using Unity3d physics engine

I have this code that simulates the movement of a projectile without using the unity physics engine IEnumerator LaunchProjectile(int angle, float speed) { // Move projectile to the position of ...
47 views

### Rotate Object inside room according to wall

I have a room. I am trying to move an object whenever it collides with a wall. It's working properly except at the edge of two meeting walls. At the edge it's flicking. I tried to move the object when ...
22 views

### Finding specific coordinates on a rotating line

I'm currently working on a mobile game which mainly consists of a rotating line and a ball. The line rotates 0.500 degrees clockwise around its center every frame. The ball is at first positioned in ...
673 views

### In UE4, how do I turn my character's body together with the camera?

I made a simple punch animation in Blender and exported it into Unreal Engine 4. In-game, the character appeared from a 3rd-person perspective, but I made it look like first-person by adjusting the ...
206 views

### Quaternion.LookRotation() not rotating 360 degrees

In my scene I have two cubes one has a tag "Respawn" and another one has the following script attached: ` using UnityEngine; using System.Collections; public class NewBehaviourScript : ...
617 views

### calculating torque from angular momentum considering inertia moment

so I am trying to determine exactly how much torque to apply to a 3d model to make it rotate at a particular rate. I apply force from the location of each engine on the craft so if one breaks the ...
1k views

### How to make my 2D character stand normally on slope?

I've got this character in Unity3D (2D Mode)... in a a slope which looks like this, But I want the character to stand along the red line..Like below How can I make it in Unity3d? I've got this ...
80 views

### How much to roll Z to make horizon level

I've got a flying camera with some arbitrary rotation. (It also has a translation, but that's not important.) It's flying along its local Z axis, traveling in some direction over the ground with some ...
129 views

### 3D 3-axes rotation into 3D 2-axes rotation

Hello everyone and thanks in advance to anyone who'll help me through this ! I am currently working on the Kinect V2 (for XBox One) to interact with an avatar. I'd like to use the rotation quaternion ...
248 views

### Rotating A 2D Cannon Based On Mouse Position [duplicate]

I'm creating a game like bubble shooter, I have a cannon which is in the image bellow: I want to rotate the cannon based on mouse position. So far I tried various solutions I found over the web but ...
122 views

### Faking Perspective/Depth using 3D images converted to 2D sprites - Can't work it out!

after a lot of searching/reading/viewing old school game videos I am still unable to work out how to achieve the effect I am after. I am currently working on a 2D "overhead view" sci-fi RPG, using a ...
23 views

### Inverse kinematic joint limits

I want to limit the joint angle of my character. I have just one issue i can't get the value of the joint limits of the human -i search about max, min angle of each joint in x and y but i can't get ...
44 views

### How to use rigitbody2d.AddTorque() in JavaScript? (unity2D)

I just want to know how to use rigitbody2d.AddTorque() and an example script would be great :D. I am trying to rotate a cube forever using it as a test.
327 views

### Projectile Rotation During Flight (Tank Game)

I have a tank firing projectiles into the air. I want the projectiles to be rotated relative to their position along their flight path. See the diagram I drew in the image below. At any given point ...
406 views

111 views

### How to implement angled surface?

I'am trying to implement 2D platformer game inspired by N game. But the problem is I have no idea how to implement something like this: I have two ideas of how this could be implemented but i don'...
56 views

### Simulate a velocity sensor attached to a softbody node with bullet physics

I try to implement a virtual three-axis velocity sensor attached to a softbody node. The node already provides it's global position, normal and velocity, but how to calculate it's local velocity to ...
184 views

### XNA 2D rotation Matrix offset/origin

I'm currently struggling with finding the offset for my original camera translation after I have applied a rotation for it. transform = Matrix.CreateScale(new Vector3(1, 0.75f, 1)) ...
189 views

### Quaternion rotations & transforms from global to local space

I am trying to solve this problem and getting no where, could really use some assistance. Rotation is defined as X (rotate left/right), Y(rotate up/down), Z(roll) Coordinates are X: Forward/backward, ...
170 views

### Unity 3D - Rotate towards object with random offsets

Title is a little confusing, but let me explain: I want to make the enemies look at the player, and shoot at him, with random precision, meaning that one time the enemy will shoot a little bit to the ...
296 views

### FPS horizontal smooth camera rotation

I have a problem, my camera is parented to the FPS Controller prefab, then there is a script I wrote for the rotation of the player horizontally by mouse movement, it all works but the rotation is ...
50 views

### Rotation matrix is being inconsistent with pitch and roll

I'm calculating the rotation matrix for a turret when it's at an angle in Javascript. I have XYZ co-ords for the turret and target with X being 90 degrees right, Y being straight ahead and Z being ...
86 views

### Rotating the view around the origin of the world coordinate system

In OpenGL (using shaders), I want to implement a system that will take the user's mouse as input, and then rotate the view about the origin of the rendered scene. So, I need to compute the view matrix ...
1k views

### Make camera follow and rotate with player without childing it

I want to have a camera, that follow the player, without childing it to the player object. So far I have this one line, that follows the player, but does not rotate with it (meaning the camera should ...
330 views

### How to make sprite move in any direction?

I have an arrow sprite that rotates based on where my cursor is pointed, I can only make it move up,down,left and right.How about in a diagonal way? //this is the rotation nt x=Gdx.input.getX(); ...
235 views

### Unity 3D - Confine a gun rotation within certain degrees

I am having troubles making my gun rotate up and down, and have limits, for example, I want the down limit to be 0 degrees, and the up limit to be 90 degrees. Currently I can't figure out how to ...
125 views

### Rotation in 3D space using Quaternion

System Configuration I have two simulation systems (which I am going to call Sim-A and Sim-B) where I am going to spawn an entity created in Sim-A inside Sim-B. Expected outcome The entity created ...
188 views

### Unity - Check if object is facing Vector3 coordinates

I am having a hard time figuring this out, I want to have objects that move around randomly, and when they get new coordinates to move towards, face them, and then move. Here's explained: Target ...
54 views

### 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 ...
143 views

### OpenGL 2.1 rotation , Gimball lock

I'm working on a little app for a school project , which should be manipulating 3D objects. And i'm stuck with the rotation , as i'm facing what i think is called the gimball lock ? here's a video I ...
112 views

### How to calculate if a point is contained in rectangular camera viewport with rotation?

I am working with my camera, and am trying to improve it so that I can calculate if a world point is on screen, taking rotation into account. Currently, my camera rectangle is calculated as so: ...
55 views

### Acceleration and Deceleration During Rotation

I'm attempting to have a sprite rotate in a way where its rotation speed increases until it has reached the halfway point in its rotation, to which it starts to slow down. I'm currently calculating ...
120 views

### How to calculate a quaternion rotation between 2 vectors with a specific final up vector?

I know you can calculate the quaternion rotation between 2 vectors with something like this after all the optimizations: quat quat::fromtwovectors(vec3 u, vec3 v) { vec3 w = cross(u, v); ...
103 views

### Player rotation issues (Player returns to default forward rotation after releasing keys)

So basically what is happening is that my player rotates and faces the direction that he is currently being steered toward (which is wonderful). But after I release, let's say the A key, meaning he is ...
248 views

### Why is the camera tilting around the z axis when I only specified x and y?

My goal is to program a camera to point towards the mouse cursor. I attached the following script to the Main Camera. using UnityEngine; using System.Collections; public class CameraController : ...