|
I'm Stuck!! How do I correctly lock the z axis so it cannot rotate, and how can I get the rotations to be smoother (less sensitive)? Thanks a bunch for any help!
(comments are locked)
|
|
You can try using the "lerp" function to get smoother rotations, and setting rotation.x to zero fixes the rotation problem right? Check here for a reference on all kinds of "lerp" functions. Here is how you would "lerp" angles: And here is how you would "lerp" a vector3: no, I set the x to zero to just when the character controller is not grounded (for when they jump or swim). I am aiming to get the player to rotate to the slope beneath it when grounded. How would I plug in a lerp function?
May 29 '11 at 06:38 AM
superventure
lerp functions basically work like this: the move from one position to the next and how fast. It all depends on what you want to lerp, though. For instance, Vector3.Lerp(fromPositionOne, toPositionTwo, timeToLerpInSeconds) is how you would lerp a vector. Check the link for a bunch of different types of lerps. Also, if you want there to be no rotation then set the rotation dimension to be zero.
May 29 '11 at 06:43 AM
SirGive
I tried plugging transform.rotation.z =0; into the script when it is grounded, but it made things worse by upsetting all the rotations, so that is why I need help there. Is your example for locking with a new variable in C#? I only know java script. Also, I meant how I would alter transform.Rotate to lerp instead.
May 29 '11 at 07:10 AM
superventure
yeah. for JS just don't use "new" mathf.Rotate(firstAngle, secondAngle, speed) for the angle you want to rotate.
May 29 '11 at 07:13 AM
SirGive
Okay, I'm sorry but I keep getting lost- I don't know how to set up either Vector3(var.x, var.y, 0) or Quaternion(var.x, 0, 0, var2) correctly. I keep getting error messages. var.x? I've never seen a var set like that. Also, how would I define either the first angle or the next angle I need to lerp to?
May 29 '11 at 07:35 AM
superventure
(comments are locked)
|
