Tagged Questions

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

154 views

How to handle angles in an isometric game?

I am working on my first isometric game, and I am not sure how to go about angles and rotation. Basically, I want the player's forward movement and rotation to coincide with the isometric angles. I ...
75 views

Extract a rotation matrix given a camera direction (vector) and a up vector for the camera?

I am having some issues constructing a rotation matrix from a camera direction vector. The Up vector is computed from the camera direction as such: up = cross(cross(direc,(0,1,0)),direc) How do i ...
42 views

How to compute a transformation matrix that describes each position and rotation on a sphere?

I am having an issue constructing my transformation matrices, for this sphere problem. I know the 3d coordinate of the center, and the radius of, the sphere. Since I know the radius and center ...
44 views

Smoothing a rotation vector

I am currently using OpenCV to track the face of a person. With this I extract the feature points and calculate the objects heads pose by applying the "solvePnP" function. This function gives me a ...
164 views

Rotation in animation not working

I have a model of an SMG with arms exported from Blender and set to generic rig in unity import settings. I was creating an animation for this model in Unity Animation tab, it included changes in ...
9 views

Unity 3d Js head bone rotations

There is another version of Head Look script (link here, and code below) https://xenoaisam.com/2015/04/28/unity3d-eye-focus-and-head-look/ This is a simpler open source code that works better with ...
33 views

Camera movement on a sphere, and how to look while doing it

I am trying to make some kind of pointerlocked walking simulator that involves movement of the camera on the inside of a sphere. I've looked at Walking on a sphere, but that solution fights what I'm ...
65 views

Libgdx Sprite rotation around specific point

I made complex dynamic body that rotates around other body that is static. It works perfectly, however I got messed up with sprite position on that body. Here's what I have now and here's what I ...
332 views

How can I add banking and rotation to this object manipulation script?

I have made a drone script that allows user to move in four directions and ascend/descend. I found a nice tilt snippet which makes the thing bank when it moves. However, when I include this, the ...
82 views

Rotating A model in 3D so it matches its direction of movement

So I have a model of a spear and when it gets thrown I want to set the orientation of the spear to its direction. ( I also want to use this for other things like bullets pointing in the direction ...
39 views

How to spin a 2D quad in place using only matrices?

In short, I have a textured 2D quad (a sprite). I would like to rotate/spin it about the z-axis (coming out of the screen) using nothing but matrices. If I do the following to a transform with scale ...
62 views

Rotate a UI Image exactly 360 degrees over the course of 1 second?

I have a UI Image that I want the user to click and have it rotate 360 degrees once on the z axis. I can get it to rotate through a coroutine but I'm having trouble making it stop once it is started. ...
34 views

How to rotate with quaternions

I need to simply rotate around an axis, but because unity uses quaternions for calculating i have issues with converting into euler angles. When i ask for rotation of an object in euler angles it ...
91 views

Rotating hitboxes in pygame?

I'm using pygame.rect.colliderect() to check hitbox collision between sprites in my game, but now that i'm rotating the sprites, I'm realizing I can't do this because there's no way to rotate a pygame ...
75 views

In Game Maker Studio, why does the image rotation have to be performed every step?

I'm a software developer who's trying to get into game development casually on the side. I picked up Game Maker Studio a while ago on a Steam Sale, and I'm finally getting into using it, especially ...
58 views

How do I stop the player from rotating when they collide with a tile?

I use Touch movement and if I jump and hit a corner with the feet of my player, my player rotates but I don't want this. Can anyone help me jumping without rotating if I hit anything ? here is my ...
59 views

How can I find the rotation of a hinge joint?

I'm wondering if there is a way to get the rotation of a hinge joint. Not the actual transform.rotation/localRotation/Rotate etc. but like the rotation of the hinge joint component. For example what I ...
103 views

Would Raycast suffice for a game clock based on sun position?

I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional ...
132 views

How to clamp a direction vector within a direction pyramid?

In 2D you can specific an angle range such as [-45 to +45] and clamp a 2D direction vector within that angle range. I want to have something similar for 3D. I want to specify the allowed directional ...
277 views

Box2d set sprite to body that rotates around specific point

I want to rotate kinematic body around a specific point (I already done this part using shape.setAsBox(1.8f / PPM, 0.2f / PPM, new Vector2(5.2f, 0), 0); What I try is this: PolygonShape shape ...
33 views

Translate D3DXMatrixLookAtLH to Unity compatible code

I am currently trying to port a really old Game (I have the source of it) to Unity as a fun project. And I'm currently stuck with the object rotation techniques in Unity compared to the ones used in ...
47 views

Can you explain the following C# script for camera behavior

Here is the script, it rotates the camera left right with a target "player in this case" rotating with it. using UnityEngine; using System.Collections; public class ControllingCamera : MonoBehaviour ...
131 views

360 degree quaternion interpolation?

I am in the process of implementing interpolation into a simple game loop I am playing with after reading the infamous "fix your timestep" article (which is amazing by the way). I have the position ...
61 views

Getting vector relative to other vector in rotating object

So I have a rotating object a. It is rotating at non-constant speed around it's local x axis. It is parented to object b. When the object a rotates, it's local x axis stays facing the same direction ...
149 views

Rotation around arbitrary vector (using quaternions?)

I currently have a camera which orbits a specific target object, always looking at it. The user can drag the mouse to move the camera left/right/up/down and the camera will move over the surface of a ...
203 views

How to rotate a triangle towards the point in Qt?

I have an issue with items rotating. I have a point and a triangle which needs to be rotated with its apex point towards the taregt point. The right side of the picture represents how it is should to ...
63 views

Rotate object with mouse look script

I would like to rotate an FPS camera slightly upwards during a shot as an effect of recoil, but the problem is that I have a mouse look script as well and I assume it prevents me from achieving the ...
149 views

Unexpected quaternion rotation behavior

First off let me apologize for the vague title but I really couldn't think of a more descriptive one (maybe after reading this a more advanced user might be able to edit it). Alright, so I have been ...
63 views

Making the CCTV and its Detection Area Pointing to the Player on Unity 5

I am now playing with the Unity Stealth project. Goal I want to make the CCTV pointing to the player (a sphere) instead of playing its rotation.y animation when the CCTV detection area is detecting ...
104 views

How to programmatically create an animation that linearly interpolate between two rotations?

I would like to programmatically create an animation that linearly interpolate between two angles (using the shortest path). I wrote the following code : Animation anim = gameObject.GetComponent<...
169 views

Aiming direction using mouse

I'm using the following code to rotate my object using mouse, for aiming direction. The only problem with this is that it only rotates between 0 to 180 and not full 360 degrees. Can any help me locate ...
106 views

Moving a ship forward from rotation

I am making a simple space simulator, where the player can control a ship using 2 controls, one for pitch and one for bank. The ship is properly rotated but I cannot figure out how to make the ship ...
64 views

Problems making a smooth character rotation

My character has an angle rotation, when the player touches the screen it automatically face to the place that the player touched, using atan2(y,x) and Math.radiansToDegrees methods, but I want it to ...
64 views

NavMesh.SamplePosition() fails after rebaking NavMesh?

So today I was refurbishing a scene when this happened. After baking a new Navmesh the SamplePosition() returned only infinity. I tried a lot of things out but eventually went back to an older version ...
57 views

Strange behavior with transformation matrix

I'm fairly new to transformation matrices. I'm using them to translate and rotate nodes and their child nodes. The following code works when applied once, but shows strange behavior when applied many ...
102 views

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 ...
16 views

C++ Opengl rotation Rotating vector before transform still rotates around 0,0,0… In world position [duplicate]

So how should I get this to work in local position? (Ie, moving to 4,0,4 and rotating around 4,0,4 . (x,y,z)) Here is where I add models / verticies: glm::vec4 pos = glm::vec4(1.0); glm::mat4 ...
59 views

Increasing the rotation angle on a quaternion makes the rotation stop at a certain angle

I'm using the following code to change the rotation of an object: Quaternion rot = getRotation(); setRotation(make_quaternion_axis_angle(rot.v,rotationSpeed*dt)*rot) This code works as expected ...
42 views

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 = ...
88 views

Rotation, what is the Matrix?

From a previous question, thank you very much by the way, but what on earth is the Matrix of? I'm very new to Mono/XNA and finding any meaningful documentation is practically impossible. point = ...
614 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 ...
47 views

Changing the central point for transform [duplicate]

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 ...
181 views

Position child on the edge of the parent circle while scaling unity3d

I have come across to some different situation. I have one circle sprite and i am rotating circle continuously while rotating i want to make circle smaller and larger. I have one object on the edge ...
186 views

How should I rotate vertices around the origin on the CPU?

I have tried using glm::rotate and such. glm::translate works fine, but rotate doesn't work (if I rotate before/after a translation). Here is my current setup: glm::vec4 Off = glm::vec4(0, 0, 0, 1); ...
16 views

Rotating the playing field. (MonoGame) [duplicate]

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 ...
159 views

How to avoid Gimbal Lock on Rubik's Cube [duplicate]

I am making a Rubik's cube program. That will simulate a Rubik's cube. I am having problems with gimbal lock. I need to know how to avoid it. To my understanding I can either multiply the x, y, z ...
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 ...
29 views

how to pin down a sprite partly in unity?

I am working on a simple do not let the bombs hit the floor game for android. You control a stick which can rotate to left or right depending on where on the screen you touch (left or right). But I ...