Quantcast
Browsing all 133 articles
Browse latest View live

Help with translating and rotating a camera

I've built a simple 3D scene and put some 2D sprites in the scene. I have a camera that overlooks all 8 sprites. There are 4 close to the camera and 4 far away in the distance. I'm trying to...

View Article


How to rotate smoothly

Hey, I started Unity a week ago and until now some search here help me but now I'm kinda stuck. The thing is, I want to rotate an arm smoothly with the mouse Y coordinate so I try to use...

View Article


A problem with Quaternion.Slerp

I have a spaceship with a Rigidbody which can be controlled by the user. Inside FixedUpdate I modify x and z rotation to turn it upright while the user still controls the spaceship. It's a kind of an...

View Article

How to rotate an object using quaternion.slerp locally with restriction?

I want to have an enemy that rotates around y-axis at random value, with a restriction at how much angle it can rotate locally. I tried various methods and simple transform.rotatearound worked....

View Article

How to rotate an object around itself relative to the camera using Slerp?

I'm making a game and in this game I need to rotate a planted using the mouse left button, so I used this code: `public int speed;` `public int lerpSpeed;` `private float rotationX;` `private float...

View Article


Getting a smooth rotation with Quaterminions slerp in IEnumerator

I'm trying to get an AI character to follow me around and I'm having some trouble getting him to face the object he is chasing. Here's my code. IEnumerator UpdatePath() { float refreshRate = .25f;...

View Article

Transform rotation and position on key input: rotation only working the first...

Hi, I want to rotate and move a game object to a set position and rotation. The transform.position is working fine, but the rotation only works the first time I press the q and w key, but after that it...

View Article

Object rotate and slowly stop to toward

Hello. I want to rotate object by z axis. Here is my code. [SerializeField] GameObject obj = default(GameObject); float _lotationSpeed = 50f; float _stopAngleZ = default(float); // determine stop angle...

View Article


How to Quaternion Slerp back to Original Position but Keep Current Heading?

Hi guys, I'm using this code: transform.rotation = Quaternion.Slerp(transform.rotation, originalRotationValue, Time.time * rotationResetSpeed); which works great. However, originalRotationValue returns...

View Article


Use curve effect on rotation?

Hey all, I have a game where an object of mine with a rigidbody rotates into the ideal position for the direction it's facing. Here is the code: float my_Aerodynamic = 0.2f; my_Rigidbody.rotation =...

View Article

Can't turn Y axis if terrain Hugging

I just recently applied code that would make it so that the character would terrain hug i.e. change angle according to the angle of the terrain underneath them. The problem is that I'm terrible with...

View Article

How can I rotate an object to a specific angle over time.

I have looked at quaternions and slerp but it's all really confusing to me for some reason. Ideally I want to have an object rotate from (0, 0, 0) to (0, 180, 0) over time. I tried to do it but it...

View Article

Lerping Quaternion Eulers.

Is there anyway to Lerp/Slerp these values so that it takes time to reach them, and it isn't just instant. Vector3 dir = target.transform.position - turretBase.transform.position; Vector3 dir1 =...

View Article


Camera orbit to specific point on object?

Hey guys. I'm using the MouseOrbitImproved script to orbit around an object in my project, and that's all working perfectly fine. http://wiki.unity3d.com/index.php?title=MouseOrbitImproved The objects...

View Article

Help convert kinematic style movement to Forces.

Hi, sorry to bother you guys. I'll get to the point: I have this code for moving an object towards a point, it also slowly turns the object towards the target. So, instead of moving in a straight line,...

View Article


smooth rotate around x-axis using quaternion.slerp

hi all, i want to rotate sphere around x-axis by the amount of displacement made by via dragging mouse in vertical direction on screen. how to calculate the angle as per dragging distance by which...

View Article

quaternion sleep (trying to make slower turns?)

hey gang, trying to fix my quaternion.slerp so it slowly turns to face the target, but it spins really fast (doesn't seem to matter if TurnSpeed is 12, or 0.1) its always at the same speed rather then...

View Article


By-pass the 'shortest route' aspect of Quaternion.Slerp

Hey, when using Quaternion.Slerp for rotating an object, the function will pick the shortest path to get to that position. Is there any way to bypass this and force the direction of the rotation...

View Article

Enemy rotation while looking. Help.

Hello every one! I have a script that makes the enemy AI look around for me. If I have my flashlight on, he can spot me from greater distance. However, when he spots me and I get closer, the enemy...

View Article

Preventing a gameobject from looking upwards?

I have a gameobject that looks at another gameobject above it using Quaternion.Slerp. I want the gameobject on the ground to look in the direction of the other gameobject in the air but I don't want it...

View Article
Browsing all 133 articles
Browse latest View live