AddTorque stops working when model is vertical
I've created code for a rigidbody spaceship and it works perfectly unless the model angles vertically (X=270 or 90). When it hits that, the model still angles very slightly but snaps back into place...
View ArticleI want to rotate object away or towards camera around x-axis
Hi Unity people and consumers. Currently working on an controller that can grab stuff and manipulate it. I currently have gotten stuck due to a problem with my rotation function. I want it to be able...
View ArticleTranslate from JS to C# localEulerAngles
Hi i need help with some js code example i dont know how to use transform.localEulerAngles in C# properly.Basicly its a script for a character that turns the character to certain angles without turning...
View ArticleFixing the rotation around a particular axis using Quaternions?
I have a problem. I have a gameobject and I want to set its rotation around it's local Z axis (blue) to some value (lets say 0) whilst preserving it's rotation about its local X and Y axis (red and...
View ArticleSetting an objects angle about a local axis without localEulerAngles?
Hey guys (and gals), I'm looking to set my objects rotation around its local z axis to a specific value (in the below case 0). The problem is that I can't work out how to do it. I know people use...
View ArticleArm rotation question
Hey.. i did this script for move an arm up and down, but is not how I wanted to.. in this script, if i press Z or X the arm moves up and down continuously .. why? i would like that if i press Z the arm...
View ArticleConstrain XZ while setting local Y-rotation free. How?
Hi there, I have a game object that should be contraint to another game object's rotation. But I want this game object to able to freely rotate around it's own Y axis. (Because I want to rotate this...
View ArticlelocalEulerAngles.x rotates as in world space
Hi! I'm making a game with flying pigeon on android with accelerometer contol, and i have a trouble with rotating it in local space. Everything is allright when i'm flying straight and want to turn up...
View ArticlelocalEulerAngle.z to a float Y axis
Hello everyone, i have a simple math question, i have a obj and i have the local Z angle of this obj, i need convert this Z angle to Y axis, but remaining LOCAL not global. I have a WRONG example but i...
View ArticleTilting with transform.localEulerAngles and Vector3.Lerp not working.
Hey guys, and thanks in advance for reading my question. I've got the following problem: I've got a transform with a child and I want to rotate the child over the Z axis, based on the parents rotation...
View ArticleWheels Rotate or Turn, but not both
Hello! I have problem with my wheel rotation. It works if I just make them rotate or if I just make them turn, but not both at the same time! What am I doing wrong? public Transform wheelFLTrans;...
View ArticleBike stay upright based on surface normal
I'm having issues thinking of a good way to align my bike to the surface its riding on by modify the local z axis, without messing up the rigidbody simulation. I am able to get my bike to balance by...
View ArticleWhy Local Rotation Faster than World Rotation (Degrees/Second)
I am working with a player control that handles player rotation and camera rotation all in the same Update function. I rotate the camera in local euler rotations and rotate the player in the world...
View ArticleProblem with using Rotate and localEulerAngles...
Why does this not work? object.localEulerAngles = new Vector3(0,changingValue, 0); object.Rotate(60*Time.deltaTime, 0, 0); //the result of this is "object" randomly alternates from turning and...
View ArticleC# Mathf.PingPong Rotate Back and Forth
I've been trying to get my gameobject to rotate back and forth using Mathf.PingPong. It only goes from origin to rotFl. I need it to go from origin to rotFl then switch to from origin to -rotFl. Any...
View ArticlelocalEulerAngles has trouble above 87.5 degrees
I've got a sun object that rotates around the world just fine, but when I try to make a time system that gauges the time by the sun's position in the sky, using transform.localEulerAngles.x (it rotates...
View ArticleUnity Simulate Local Rotation
I've run into a situation where I need to be able to use a relative Y rotation for my player. This is so the player can walk on walls, floors, and ceilings and operate "the same way" regardless of...
View ArticlelocalEulerAngle quick question
transform.localEulerAngles = new Vector3 (0, 0, -whatever.transform.localEulerAngles [2]); Can anyone tell me what the [2] means in this situation? Thanks a lot
View ArticleSetting a local rotation via script results in a 180 degree difference in...
I have a character and I'm **trying to set some of it's joint's local rotations** to certain values (clamping them, to be precise). The results were different from what I've been expecting, so I...
View ArticleI am using Mathf.Atan2 to find angle in 2d and do not know how to apply...
Vector2 difference = anchorRotation- anchorRotationLastFrame; float angle = Mathf.Atan2(difference.y, difference .x); float angleInDegrees = angle * Mathf.Rad2Deg; Vector3 rotate = new Vector3(turn, 0,...
View ArticleOptimizations: Should I use Update or FixedUpdate? Could you help me optimize...
Hello, I have a lot of MoveTowards and "rotation" type code for my bad guys that are spawned. They rotate (they are balls) and they also MoveTowards a location. How can I optimize this code to run more...
View ArticleGetKeyDown works only once
Hi, I want to make my character rotate in the direction which he is facing(the game is top view), and I encountered this problem: Whenever I start the game, I start facing up, and I can press the arrow...
View ArticleSpaceship steering limit
I'm making a script to control the spaceship using Rigidbody and localEulerAngles. I made steering the spaceship by using mouse, now my question is how would I limit the rotation. For example : Right...
View ArticleLocal Euler Angles not Rotating GameObjects
Hello all! I am having trouble getting text to follow alongside my weapon for my VR game. I would just set it as a child of the gun, but this causes the text to lag behind the gun when the gun is...
View ArticleMultiple Coordinate Systems
Hello, I am rotating a UI object about the localEulerAngles Z axis. After I rotate it, I want it to translate vertically along the rotated X axis. However, it seems that when I use the following code,...
View ArticleHelp with creating rotational mapping
Hello all! First of all, I am sorry for my non-fluent English. In my project, I have to match the movement of body parts between platforms. Initially, i thought about matching their localEuler...
View ArticleI tried to align a piston along an axis.
void SetRotation() { float currentRotationAngle = myTransform.eulerAngles.z; Vector3 axis = label2.transform.position - label1.transform.position; Vector3 piston = direction.transform.position -...
View ArticleRotating an object taking into account the main camera.
I currently have a script that depending on the joystick axis, rotates the object a certain way, I then send that rotation to the player and orient them on the direction this object is currently...
View ArticlelocalEulerAngles command does not work well..
Hi to all, I try to control my object's rotation by using the localEulerAngles command. However, ıt did not work well. When the object rotates 0, 0, 90 angles in the x, y, z coordinate, command give me...
View Article(unity2020.3) weird behavior by transform.localEulerAngles (i want to get...
i found some solution (if its greater than 180, subtract 360 from it) but it did not work [check out this video](https://i.imgur.com/qJ6pbUc.mp4) first value is euler angle second value is local euler...
View Article