- Home /
Bone position is off when it's the child of my camera
Hello, I am working on a first person shooter and I have made the main camera with unity's mouse look script the parent of the spine bone but the spine stretches and goes all over the place. I have tried making the camera the child of the spine and put the mouse look on the spine bone witched worked out well except the player's arms wobble, when the players head is pointed up the arms are zoomed outwards and if it is pointed downwards the arms are zoomed in. I don't know what to do. Here are some pictures to clear things up
Spine as child:
head pointed up
normal head tilt
as you can see the head looking up the arms are zoomed out and the head looking forward the arms are zoomed in
I will upload the rest of the pictures in comments
any help would be appreciated, sorry if this questions bad, I haven't posted anything in almost a year
thanks for reading :)
_1
It's a VERY bad idea to break a bone hierarchy. For animations and skinned meshes to work, the hierarchy $$anonymous$$UST be intact. If you want your torso to follow the camera's rotation, a good way is to cast a ray from your camera and store the hit.point. Then use the Add$$anonymous$$ixingTransform function so animations that normally would influence the whole rig don't influence the torso and everything above. Then use one of the I$$anonymous$$ scripts available for free or on the asset store and pass it the hit.point stored earlier to make your torso point towards it.
As for your problem at hand, I would guess that this behavior occurs because bones can have really weird pivots, depending on the 3d modelling program used to create them. That means that simply functions like making a transform rotate around it's y axis might mean that the bone in question does something wholly unexpected because the axis setup doesn't conform to the Unity standard of x = side, y = up&down, z = forward & backwards.
ok, I will try some of your suggestions, thanks for the suggestions
Why not make the camera a child of the model ins$$anonymous$$d?