- Home /
rotation z of child wont work can some one help me plz
hey guys i am trying to make a sort of sentry turrent winth a Y rotation and for its gun arms an Z rotation this is the sentry gun its self partToRotate its Y works fine it locates me and turns to to me as target
but the gun arms on the turrent wont rotate on its z axis partToRotategunarms the gun arms are a child to the Sentrygun`s body the sentry gun to its base and i animated it so it will pop out of the ground this is what i use i got it from a tutorial but the guy didnt explain how to set the rotation of the arms mine hass.
![Vector3 dir = target.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(dir);
Vector3 rotation = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime * rotationSpeed).eulerAngles;
partToRotate.rotation = Quaternion.Euler(0f, rotation.y, 0f);
partToRotategunarms.rotation = Quaternion.Euler(0f, 0f, rotation.z);][1]
[1]: /storage/temp/191322-gunturrent.jpg
it turns out that my animator was the problem for some reasoni fixed it
Your answer
Follow this Question
Related Questions
Sprite rotation (z-axis) and translation (y) is not working 1 Answer
Get current Z rotation of transform in degrees 0 Answers
how can i stop rotation without stopping y axis 2 Answers
Turret Continuing to Max Rotation - Following Mouse Cursor 0 Answers
How can I rotate a tank's turret back to the starting turret position? 2 Answers