- Home /
The question is answered, right answer was accepted
Getting barrel to correctly aim at object
I have a turret that rotates on its X-axis in both Blender and Unity. But constraining its LookRotation on the Z-axis is the only way I've gotten it to rotate the way I want it to in Unity.
Despite correctly rotating on the Z-axis, the barrel itself doesn't aim at the objects, I think the center of the pivot point is what's actually looking at the objects. I'm new to both Blender and Unity but I think this is mainly a Unity problem. With Unity and Blender both doing axes differently, I'm incredibly confused. What do I have to do in Blender to ensure that the tip of the barrel is what's actually looking at objects in Unity?
I cannot help you with Blender, but it is easy to see how it is positioned and rotated in Unity. Put a small object at the origin. Typically I use a sphere sized to (.1, .1, .1). Bring in your gun and place it at the origin. Both object should have a rotation of (0,0,0). In this configuration, the pivot for the gun should be at the the object at the origin. The barrel should be pointed at positive 'Z'.
Answer by LeftyTwoGuns · Aug 17, 2013 at 01:18 AM
I think I got it. My turret is just a simple place holder model, with one cylinder rotated 90 degrees on the Y axis in Blender, and another cylinder (the barrel) placed on top of it upwards a long the Z-axis and joined together as one object. The barrel was pointed in the right direction but the cylinder wasn't (which I obviously couldn't tell because it's a cylinder). What fixed it was rotating the base cylinder by 90 degrees, but then using Apply Rotation to reset it's transform rotation back to (0, 0, 0). Which made both the rotating cylinder and the barrel facing the same direction.
Blender to Unity seems pretty quirky : \
You should also check out "LookAt" which is used constantly in Unity and very handy
Follow this Question
Related Questions
Blender > Unity - help with unwanted bone twisting/rotation? 0 Answers
Aligning an object's rotation direction to a vector 2 Answers
Inverse Rotation in Child Object 1 Answer
Blender imported model textures has wrong rotations and repeats 2 Answers
Blender Animations with Different Starting Rotations 0 Answers