Questions tagged [rotation]

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

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

Why do I need to offset my aim rotation angle by 90 degrees?

I have this simple code to rotate an object (gun barrel) towards a target object (rocket ship). The gun barrel rotates towards the ship but is always 90 degrees off. I have fixed this in my code as ...
1
vote
1answer
1k views

Mouse look rotation not rotating object axis in Unity

So, I made a simple First Person Camera script for my game, and the way it's supposed to work is the camera is rotated by localEulerAngles to rotate the camera around, and then just the Y-axis ...
0
votes
1answer
132 views

Rotation doesn't turn towards characters on right

So I'm working on a tower defense type of game and I have a rotation set up that is supposed to follow a chosen enemy. What I'm seeing is when the enemy comes from the left the turret turns quickly to ...
-1
votes
1answer
38 views

How do i rotate my view on its own center

PROBLEM I am trying to translate and rotate my view, the translation works fine but when rotating the rotation is happening on the center of the world(0,0,0) instead of the view position. EXAMPLE ...
0
votes
1answer
24 views

How to orient a layer to connect 2 points AND facing the camera

here is my question, which I hope will be in general interest: If you have got 2 Points in 3D space and want a plane to connect those, you can quite easily use a function similar to "lookAt" to ...
0
votes
1answer
998 views

Can't set object's local rotation like rotating from gizmo in the scene

Here, I have a plane model with some sub parts(like aileron) can rotate: That red section is weight painted(rigged) vertices, and I need to control the rotation of this in Unity by script. So this ...
0
votes
2answers
173 views

How to rotate object just like in the scene?

Look at this image, I selected an object and pivot is set to local: When I rotated selected object in the scene by X axis, it rotates exactly I wanted. But if I rotate axis from inspector or script, ...
2
votes
1answer
787 views

Unity: Particle System start rotation completely incorrect when set via C# script

I am trying to set the starting rotation of a particle system via c# script so that the particles orientate with another object in the scene. My particle system 3d rotation is set as follows: ...
0
votes
1answer
58 views

How do I get a delay in motion to happen? (Unity)

I want the cockpits rotation to lag behind that of the cameras, so I wrote this code: ...
3
votes
1answer
4k views

Converting a quaternion in a right to left handed coordinate system

I have a quaternion from an IMU that id like to represent in unity. The issue is that the sensor uses a right handed coordinate system while unity uses a left handed coordinate system. In order to ...
0
votes
2answers
604 views

How to make UI Button to rotate an gameobject?

I'm trying to make a button to make a gameobject rotate and stay rotating in its own axis (Y) but I cannot make it work... As far as I know it's very simple: Create an empty gameobject (or whatever ...
4
votes
2answers
534 views

How to randomly rotate a D20 Dice in Unity?

I'm working on a Dice Application in Unity that involves randomly rotating a dice model on instantiation and then dropping it. But in order for this application to be useful I need to guarantee that ...
2
votes
1answer
101 views

Why does this work? - camera rotation from screen space

I do not understand the math behind the linked function or why it works. I would like to know this. https://sidvind.com/wiki/Yaw,_pitch,_roll_camera ...
0
votes
1answer
46 views

Setting position and look direction of a GameObject

I'm making a bendable game object comprised of a number of bones. The bones positions are calculated using some joints and some maths and that is all working as expected. But I am struggling to rotate ...
2
votes
1answer
218 views

Impulse resolution for purely rotational collisions (relative linear velocity = 0)

I've been writing a basic physics engine, (loosely) following Randy Gaul's online tutorial. I have been using this equation that he derives: $$j=\frac{-(1+e)((V^A-V^B)*t)}{\frac{1}{{mass}^A}+\frac{1}{...
1
vote
1answer
119 views

Rotate player to a specific angle using Rigidbody2D

First of all, I'm an absolute beginner in unity and coding so please excuse my lack of knowledge and my mistakes. I didn't achieve to fix my issue with others posts. I'm trying to do a little top-...
1
vote
3answers
167 views

How to add rotation to two particle collisions?

I'm trying to make a particle system where when particles collide, they merge together, to get the new velocity vector the smaller particle's force is added to the larger one. However, this isn't ...
0
votes
1answer
101 views

Object is not rotating from right direction

im beginner to unity so im using this code to rotate object with mouse with max rotation of 35 degrees,it is working but it's only possible to rotate object if mouse is under of that object. here is ...
0
votes
2answers
1k views

LookAt only in Z axis

I'm fairly new to game development, like many of us asking questions here Currently, I'm trying my luck working on a simple space shooter. I'm trying to add some enemy ships with movement, they will ...
0
votes
0answers
37 views

Torque Generation

I have written a basic physics engine. It is able to handle rotations. But how do I handle case like this where an object sits on top of another and needs to rotate due to the effect of gravity ? I ...
1
vote
2answers
2k views

Unity, rb.MovePosition and transform.Rotate at the same time

I can't figure out why my object can't move and turn at the same time. ...
0
votes
1answer
118 views

Rigidbody has unintended effect, velocity limiter from unknown source

I have made a script that alters a rigidbody's angular velocity. It works well but has one issue, its speed plateaus past a certain point. Here is the script: ...
0
votes
1answer
399 views

Unity3d: Rotating a sphere so point lines up with the camera

I'm trying to make a world map in Unity that contains a rotating globe with landing sites on the perimeter. What I want is that when a player clicks on the landing site the globe rotates so that the ...
3
votes
1answer
146 views

Pitch becomes yaw as camera gets near object

I have been having trouble with my camera, first encountering the roll tilt that is so many times asked... I fixed that issue by following the instructions at this link: Unwanted roll when rotating ...
1
vote
1answer
2k views

How can I rotate models in their local space using OpenGL?

I have a base application where a model is loaded in, however I need to manipulate the models positions and rotations independently so that each model in the scene can have its own rotation and ...
1
vote
1answer
644 views

How to stop the RotateAround function to rotate after Keypress in Unity

I have a camera follow script and I am rotating the camera with Q and E key to right and left. The Camera is a child of a ...
0
votes
1answer
100 views

How to Change position + rotation of a parent while keeping X and Z Rotation

Sooo this question is a problem , a evolution by another solution of this problem here: How can I change the parents rotation so the childs rotation is looking at a specific direction Basically: We ...
1
vote
0answers
425 views

Rotating RigidBody2Ds in Godot

I am practising programming games with the Godot Engine and I've been having some issues with RigidBody2Ds. In this case I have a ...
3
votes
1answer
2k views

Unity Pixel Perfect Rotation

I'm making a pixel-art game in Unity. The sprites are set to 16 PPU, and currently to guarantee that the pixels scale nicely (integer intervals), I'm setting the Camera's orthographic size. In 16x9 ...
0
votes
1answer
657 views

How can I set only the players X rotation to 0 in Quaternion.Slerp in Unity?

I want to set the players X axis to zero while he is turning to the target Object but I dont get it to work. Code: public float rotationSpeed; ...
0
votes
1answer
23 views

C4d or 3DS-like matrix rotations

I have a rotation 4x4 matrix to generate a model matrix, but I would like to be able to control it like cinema4D or 3ds Max with three separate angles that are always perpendicular to each other, and ...
2
votes
1answer
84 views

How can I ungrab the grabbed Object in Unity?

I modified a grab Script to my purpose, I can grab the Object and make it a parent to the character with the Key "G" but I want to let it go and detach the parent of the picked Object with "H" with ...
1
vote
3answers
5k views

How do I rotate the Camera around the player by Keypress in Unity?

I want to rotate the camera around the player by pressing E and Q but it doesnt rotates around the player. I tried RotateAround but didnt worked. Code: ...
0
votes
1answer
34 views

How to get smoother transition between the surface normals rotation of player in Unity

I kinda have a problem that my player is snapping onto the other surface while I wanna move a ramp up. I want to have it rotate smooth to the normals of the ramp. How can I change the code below to a ...
0
votes
1answer
44 views

Calculate corner rotation to fit between 2 waypoints

I'm currently working on a system where I create a linear path by spawning waypoints, but i'm struggling to figure out how to compute the rotation needed to render the corner waypoints correctly. if ...
1
vote
0answers
435 views

How should the physics be on an halfpipe like in a skate game in Unity?

I am making a inline skating game. My player is skating based on the normals of the surface of the ground. But when I skate up a halfpipe it flies in the Air but doesnt comes down like it should be, ...
0
votes
1answer
136 views

How can I add up the Transform/GameObjects in the Array of Waypoints in Unity?

I come up with this code and I try to get the waypoint + 1 when I reach the waypoint and it adds up till the last waypoint. I get Array is out of Index error. I guess I need and foreach loop of ...
1
vote
1answer
98 views

How do I simplify this code with an Array and counting int up in Unity?

I want to simplify my code. I had the idea of making an Array of waypoints[] and and int i to count up each time I arrive a new point of waypoint but it should be the same way my code is but instead ...
4
votes
1answer
973 views

Why is my model rotating opposite direction around the Y axis?

I have a simple scenario. I have a simple scene, and in it I'm drawing a grid and a model, with some axis for orientation. I noticed when I rotate the model about it's local Y axis, if I rotate the ...
0
votes
2answers
1k views

What is the best way to code grinding for a skate game in Unity?

I am making a inline skate game, what could be the best method to code the grinding system, there are many various and complex stuff to use but what could be used to set it up simple and not that ...
1
vote
2answers
1k views

How to move a player along Waypoints with Rigidbody.MovePosition in Unity?

I have a player with a Rigidbody, I want it to follow along the Waypoints. I have used MoveTowards but it seems also not to work however. I want to use MovePosition to add force while grinding. I ...
0
votes
1answer
184 views

Unity, Player isnt following along the waypoints

I have a player with a Rigidbody, I want it to follow along the Waypoints, I have a script for it I tested it first on a Cube, everything worked fine, but on my character it just moves Towards the ...
0
votes
1answer
811 views

Unity Rigidbody stops directly after moving

I'm creating a skating game, my Idea now for moving was when I move and then dont press any button anymore to move, it should still roll a bit and decrease momentum after a short while to fully stop. ...
0
votes
1answer
844 views

360 Orbital Camera Controller

I have a stationary cube in my scene that I'm orbiting a camera around. I have my MainCamera nested under a GameObject that I'm calling 'OrbitalCamera'. I setup the script so that a click (or tap) ...
1
vote
3answers
1k views

How to make a 90 degree rotation happen over time

I'm trying to take a RotateAround function and make it happen over time. I've been tinkering with Quaternions to try and get it to work but I can't quite figure it out. This is the code: ...
0
votes
1answer
280 views

Calibration using quaternion

I have an external hardware which gives me quaternion values. Now I would like to calibrate the device at a certain position and show tilt variations from that position on the UI. For example, I have ...
0
votes
1answer
909 views

What is FRotationMatrix in Unreal engine 4?

I am working on FPS shooter example in Unreal engine 4 documentation. One of the lines for forward movement of pawn is ...
1
vote
1answer
173 views

Separating Axis Theorem and rotated objects

Quick question which hopefully won't require thralling through my code. I have a working implementation of SAT for 3D collision detection but I'm having some problems with dealing with rotated ...
4
votes
1answer
698 views

Unity - moving an object around a radius

I'm trying to move a 2D object around the mouse position, However, i want to constrain the object from rotating unnaturally around itself, i want it to basically rotate around a radius, similar to how ...
0
votes
0answers
27 views

Find centre of rotation from two locations

Ultimately I need to get c from the image and have a, b and that it takes 90 degrees to get <...