- Home /
Rotating Biped's Upper Body seperately from the Lower Body
Hi guys;
I've modified the default Third Person Shooter code to the point where only a small fraction of what's left is the default part. I have a segment within the code that allows for aiming in Third Person.
Character.transform.rotation = Quaternion.Euler(gameObject.transform.eulerAngles.x,Camera.main.transform.eulerAngles.y,0);
BodyUpperPart.transform.rotation = Quaternion.Euler(Camera.main.transform.eulerAngles.x,Camera.main.transform.eulerAngles.y,0);
So the first part works perfectly, but the second part rotates my character's upper part in the wrong axis. I've changed the code so it applies to x y and z but the problem seems to be unsolved.
Character is the main model and for BodyUpperPart I assign one of the Spine Bones. I'm sure that there's a very simple fix for this problem but I haven't been able to figure it out...
Thanks in advance!
Answer by JayMHelpsU · Apr 12, 2012 at 07:48 PM
Im pretty sure the only reason the second didnt work is because you havn't defined what UpperBody is and the camera
To set the variables below to whatever they need to be :) var UpperBodyObject : Transform = "Chest"; var CameraObject : Transform = "Cameras";
Character.transform.rotation = Quaternion.Euler(gameObject.transform.eulerAngles.x,Camera.main.transform.eulerAngles.y,0);
UpperBodyObject.transform.rotation = Quaternion.Euler(CameraObject.main.transform.eulerAngles.x,CameraObject.main.transform.eulerAngles.y,0)
Actually I have, I said I assigned all of them to the proper transforms available in the scene. I don't get any errors and the transforms that I assign do move, but in irregular forms. When I just use the first line, the character moves exactly like I want it to. But when the second line is active, the first part moves fine, the upper body, the part that is controlled by the Spine Bone rotates in some weird angles.
Your answer
Follow this Question
Related Questions
lower and upper body rotation 2 Answers
Rotation on Android vs. PC 0 Answers
Camera Script Rolling on the Z 3 Answers
Unable to set Rotation 1 Answer