Questions tagged [rotation]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
114 views

Smoothly moving an orbiting object back into orbit

I have an object that orbits the player's sprite with code that looks like this: ...
0
votes
1answer
182 views

Rotation of a cylinder between to spheres in R3

I want to connect two spheres with the coordinates [ax, ay, az] and [bx, by, bz] with an cylinder which is placed in between the spheres an rotated. For the placement I calculate the center of the two ...
0
votes
1answer
55 views

Bullet direction incorrect around sphere

Here is a little background on how my game objects are set up, and how the rotations and firing bullets work. I am working on this game in Unity. I have two game objects that orbit a sphere (for ...
0
votes
1answer
93 views

Make object face another object on a sphere

I have a game I'm working on in Unity where there are two objects on a sphere at random locations (and random rotations). I want one of the objects to always rotate so that if it were to fire a bullet ...
0
votes
1answer
339 views

Create rotation in random direction from existing rotation

I am working on a game in Unity, and I currently have a game object (object A) located at the origin. I have a child of this game object (object B), that is 10 units back on the z-axis. When I rotate ...
0
votes
1answer
882 views

Moving camera in 3D - directX12

I begin to learn graphic programming on directx12. I try to make a camera wich can move dans rotate around the world. I take this code as a basis: https://www.braynzarsoft.net/viewtutorial/q16390-...
0
votes
1answer
201 views

Problem with FPS camera in Software Renderer

I am currently creating a software renderer (I know they aren't particularly useful anymore, it is purely from a knowledge and learning standpoint). I am using GLM and following OpenGL rules(as GLM is ...
0
votes
1answer
2k views

Unity Change Rotation of Animated Object at Runtime

So I made an animation, but sometimes i nedd to rotate the animation, but for some reason it isnt working. I can change the rotation of the object and then click play and it works perfectly like in ...
2
votes
1answer
2k views

Problem when trying to use rb.MoveRotation in Unity

OK so I learned that rb.MoveRotation is different from rb.transform.Rotate(). But I am having trouble using it and hoping you can help me. I usually use transform.translate(Vector3.forward) (after ...
2
votes
1answer
474 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
303 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
950 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
605 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
615 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
825 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
142 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
89 views

Unity3d: Rotation of game object

...
1
vote
1answer
519 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
372 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
7k 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
53 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
287 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
112 views

Ray is not shooting forward

This is the code for Raycast: ...
0
votes
1answer
221 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
203 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
187 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
421 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
484 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
232 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
587 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
563 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
200 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
68 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
845 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
213 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
493 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
301 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
708 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
593 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
415 views

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