Questions tagged [rotation]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
462 views

How can I rotate RigidBody and not violate physics?

I'm trying to create a game that we have a falling ball and an spinning object that spin based on user mouse position. user should rotate the object and hit the ball on time to throw the ball into sky....
1
vote
2answers
82 views

Rotating a gameworld using quaternion

I'm a hobbyist programmer at best and I had an idea I wanted to test in Unity, I wanted to rotate the game world around 90 degrees, to this end I've been learning a tiny bit about quaternions, in this ...
4
votes
1answer
92 views

Camera rotation deforms objects

I'm working on a ray-tracer in C++ with an adjustable camera for a university assignment. I'm entirely new with graphics and I'm struggling with one thing. I have a matrix as a mat4 object (4x4 ...
0
votes
1answer
291 views

Smooth Rotate Object While Orbiting

I am working on a 3D game where you can control an object that orbits a sphere with an on-screen virtual joystick. So far I have that part working, but the object follows the joystick angle perfectly ...
0
votes
1answer
912 views

How to use quaternions with JOML and LWJGL3

I'm implementing a space fps game (there is no up or down in space!) using LWJGL3 and JOML (math library). Entities in my game have a rotation based on the Forward, Up and Right vectors. I use pitch, ...
0
votes
3answers
585 views

Lerp rotation is offset

I am trying to get an object to slowly look at another object, that is, rotate slowly so its forward points towards the target position. Here is my code: ...
1
vote
1answer
578 views

How to Find Collision Reflection Vector on a Sphere

I have a game I'm building in Unity with some objects orbiting a sphere via rotating around a pivot point (0,0,0) at a radius of 10 units on the z-axis. The orbiting objects all have the same velocity....
2
votes
1answer
788 views

Rotate an object to face a point with glm::lookAt

I want to rotate an object to face a point, such as the monster look at the player. For that I've decided to use the glm::lookAt function. However the following does not yield good results: ...
0
votes
1answer
140 views

First-person shooter -style controls [duplicate]

This is not in regard to a video game, but to a 3D model viewer someone else created and I am modifying. I would like to implement first-person -style mouse and keyboard controls in the viewer, so ...
1
vote
2answers
2k views

How to rotate a local position offset based on a direction vector?

I'm trying to fire three raycasts in the direction of movement, from offset starting points. I'm having trouble calculating the start positions of the rays based on the direction. As you can see in ...
0
votes
0answers
86 views

Unity3d: Rotation of game object

...
1
vote
1answer
491 views

How to rotate an object around its own roll axis

I have a 2-dimensional image of smiley face in a 3-dimensional space. I want it to rotate like a fan, so the smiley would look as if it's rolling like a wheel in place. Since the smiley is placed in a ...
3
votes
1answer
356 views

How to 'point' an arrow in the direction that it's going?

I am relatively new to OpenGL and 3D environments and am having trouble creating a rotation matrix that will rotate an arrow model so it 'points' in the direction that it is going. I am using GLM as a ...
3
votes
1answer
6k views

Direction vector to quaternion

I have a unit vector (direction) which represent a rotation around Y axis, and would like to turn this into a quaternion to represent the same rotation. I use GLM library, but interested any library ...
0
votes
1answer
52 views

Quaternion Translation

I am writing a small game and I need some help with my quaternions. If I have an object at rotation A (quaternion) And I need it to be at rotation B (quaternion) in 10 steps how would I work out the ...
0
votes
0answers
278 views

How do I interpolate an object's rotation on a Z-axis based on mouse position?

I need to apply rotation to an object, based on the mouse movement around it to a z-axis only. Let's take this picture: Violet - current mouse position Blue - ...
0
votes
1answer
98 views

Ray is not shooting forward

This is the code for Raycast: ...
0
votes
1answer
204 views

How do I calculate the new Quaternions from translated points?

The code below is for a rag-doll using Verlet method, I have the correct points (or joints) positions, I just need the correct Quaternions, otherwise the resulting model looks like in the picture, I'm ...
1
vote
1answer
193 views

Calculating real time moment of inertia around arbitrary axis in 3d

I have a 3d rigid body consisting of multiple triangles forming a closed mesh. I know how to calculate the moment of inertia around an arbitrary axis by splitting up the mesh into simpler shapes and ...
0
votes
1answer
178 views

How to calculate a normalized direction of two rotations?

In Vector math and translations we can do: dir = (v1 - v2).norm and then v1.translate(dir * 50) so ...
0
votes
1answer
395 views

Unity - Inaccurate rotation if object is rotated on two axis at once

I have an object which i want to rotate relative to world space. I have three variables (one for every axis) which store the rotation. By pressing buttons on my controller I add or subtract 90 to ...
1
vote
0answers
462 views

SceneKit-Convert a rotation vector into rotation matrix

I'm very new and I'm studying this ARKit code from RPasecky/CubesInSpace on github where he/she convert the point of view 's rotation vector into a rotation matrix ...
0
votes
1answer
225 views

How to achieve an orbit-adjustable rotation?

Here's a script: ...
0
votes
2answers
2k views

Rotate an object with 'Quaternion.Slerp' in world space

I'm currently working on a multiplayer skydiving Unity game in which i rotate the players like this: ...
0
votes
1answer
567 views

Changing a rotation and position of the camera smoothly when a button was clicked

How can I change a rotation and a position of the camera smoothly when a button is clicked in Unity? I do not want to use Update function to implement this and I do not have a GameObject or Transform ...
0
votes
2answers
5k views

Unity Rotate Object Around Local X Axis , then Local Y Axis, then Local Z Axis (like a turtle)

I am having trouble getting my unity gameobject to rotate in the manner I would like. I would like my gameobject to act kind of like a turtle from a drawing program, where I could input a Vector3 ...
2
votes
1answer
552 views

Rotate object such that a child object is facing a target (3D)

Given a parent object A and a child object B, how do I find the rotation of A such that B is pointing toward the position of a target C. This is a simplified way of solving 'what angle does the torso ...
0
votes
1answer
191 views

Bank ship left/right based on virtual joystick

I have a 3D game in Unity with a top-down camera view centered directly above a space ship. The ship always stays in the center of the screen, but it allows you to orbit a planet freely using an on-...
0
votes
1answer
2k views

Rotate from Current Rotation to Another using Angular Velocity

I am attempting to calculate an angular velocity that will get me from the current gameObject.transform.rotation to a given Quaternion rotation using angular velocity. I've tried several methods but ...
0
votes
1answer
2k views

Convert Quaternion to Matrix4x4

I'm trying to set Gizmos.matrix which is a 4x4 by matrix such that the gizmos drawn match the rotation of the object. However, I'm not sure how to convert the ...
0
votes
1answer
66 views

Restrict the rotation of the camera using button

I've been trying to limit the Y-axis of the camera rotation but I'm out of depth until now. I'd looked up many tutorials and I found the clamping method, but I seem can't get it to work on my code, ...
0
votes
1answer
57 views

Correct the rotation of a car gun?

This script for drive a car by arrows. I added a gun above it to aim at target. My issue here is the rotating of my gun effected by my drive when I turn left or right. How to stop the rotation of my ...
1
vote
1answer
84 views

Why is my sprite moving 90 degrees to the right?

I have a sprite which i'm trying to move towards the top of the screen with the left and right buttons adjusting the heading. However when my heading = 0; my ...
4
votes
1answer
817 views

In Unity, rotating character spine keep going back to original rotation

this is the code for rotating spine in my character model: ...
0
votes
1answer
165 views

Transform.position is being changed, but character is not moving back to it when told

I'm trying to make a respawn point for my car to jump back to if it presses a button. I can see, using the Print() lines, that all the variables are correct and the methods are being triggered when ...
1
vote
1answer
480 views

With a rolling pawn, how can I have a component that follows its rotation, but stays upright and only rolls?

I'm using the UE4 rolling pawn to create a Metroid Prime morph ball style pawn. I've got it set up with a ribbon particle component on a spring arm, inheriting yaw, but if I set it to inherit roll, ...
1
vote
0answers
298 views

3D Flight with pure local rotation without roll creep

I'm working on a flight race game with a specific constraint and cannot find a solution. Hereinbelow, an image of a test scene. My ship has a cylinder (children) in front of it from which I get a ...
0
votes
2answers
682 views

How do I change from positive degrees to negative degrees?

Recently, in Unity, I tried to move a sphere along a figure-eight path. It first moves in a circle, and after completing the circle, it starts the second circle in reverse, using negative rotation. ...
0
votes
1answer
554 views

Unity rotating camera around specific Vector

I'm making a game in which the player controlls a ball. (Wow, such originality^^) It's a 3rd person game so the camera is slightly above and behind it. The ball is being controlled via WASD. Now the ...
2
votes
0answers
385 views

Solved OpenGL using quaternion to rotate camera to avoid gimbal lock [duplicate]

I read in many sources about using quaternion to avoid gimbal lock but I can't apply this practically in my code, so I have a camera class I want to rotate it with mouse so I have Euler angles Pitch ...
1
vote
1answer
85 views

Rotation ascending into infinity?

I'm creating a rotation for my sun to move, however it quickly extends to Infinity before going into NaN. I thought that taking advantage of the Matrix4f would make this much easier but it does as ...
2
votes
1answer
2k views

Relative quaternion rotation (delta rotation) produces unstable results

Use case: I have a currentRotation quaternion and a targetRotation quaternion and need to calculate the relative rotation ...
1
vote
1answer
3k views

Unity2d: orthographic camera and z-axis?

I wonder if anyone can help with an explanation of the z-axis and using unity with 2D with an orthographic camera. Up until now i have only been modifying the x and y values of game objects, thinking ...
0
votes
1answer
214 views

player 2d rotation

Hello i have one problem with my 2d game a made 2d endles racing game and i add cars spawner with prefab and on this scripts i add and coin whith box collider 2d and make trigger and when i play the ...
1
vote
1answer
4k views

How To Rotate A Vector around A Pivot Point

In Unity, I'm trying to figure out how to rotate an object around a pivot point. I found a snippet of code over on the regular stack overflow, but it wasn't working even close to correctly. I have ...
1
vote
1answer
142 views

Why does my 2D top-down joystick code occasionally stop working?

I'm working on a 2D top-down game, and am working on the player controls. I have the following code currently controlling a player sprite: ...
0
votes
0answers
444 views

Mythbuster: Mirror Operation with Quaternion

Mirror operation : all vertex positions must be reflected by a specific plane (here YZ).Synonyms: FlipHorizontal, SymmetryX, MirrorX, What implementations I already know that work: 1) Multiplying ...
0
votes
1answer
844 views

How can I change the parents rotation so the childs rotation is looking at a specific direction

I have a child object which is always having different positions and rotations (thats my VR Headsets Eye-Gameobject) I cannot modify the position and rotation of that. I want to set my view to a ...
0
votes
2answers
414 views

Why does the pitch affect the x component of the front vector?

In every tutorial for implementing a camera in OpenGL, the front vector is calculated with something like this : ...
0
votes
1answer
721 views

Am I experiencing a gimbal lock problem when rotating my cube? [duplicate]

So I'm trying to build a simple mechanic where the player see's 3 sides of a cube at a time: top, left and front(I called the front-side "Right" in my code, due to the orthographic view). The player ...