#Character not rotating
1 messages · Page 1 of 1 (latest)
Nobody? 
is the idea of this code moving from a top down perspective like in 2d, but in a 3d world?
No, a normal 3D world. The character is not rotating
You see the problem @frosty kindle ?
is your RB dynamic or kinematic?
rotating with the RB rather than the GO's transform makes you susceptible to physics-like issues. For instance if it is dynamic and you have angular drag, small increments may be ignored. Physics engine will also ignore rotation if a move is smaller than the physics sleep angular velocity
is there any reason in particular you don't want to do the rotation with just transform.rotation?
Well, I was just following some online tutorial and that's the script they were using. It's Unity 2017 though
no idea why it's not working. Do you know how to do that rotation with transform.rotation?
Quaternion newRotation=Quaternion.Lerp(transform.rotation,targetRotation,15F*Time.deltaTime);
transform.rotation = newRotation;
instead of your last 2 lines
That seems to be working but it's also affecting the walking style. When the character turns 90° the right becomes back and the character is again going right
consider what this part is doing: ```
Vector3 targetDirection=new(h,0,v);
Quaternion targetRotation=Quaternion.LookRotation(targetDirection,Vector3.up);
it is independent of where your character is facing
I'm not sure, takes the input and creates a rotation forward from the character?
Vector3 targetDirection=new(h,0,v); , here you have to set yaw (y) to rotate
You mean instead of that 0 or what?
what you can do for direction is
targetDirection = (transform.postion + movement) - transform.position