Partial synchronization of camera with the bone of the head or other object
Trying to connect the camera to the third person and first person. Most problems beat, but I have a problem with the camera in the first person. I want to get the effect of camera similar to the camera with "Dying Light" where the camera is at eye level player and the player's body is still visible in a natural way. In addition, the player's head rotates in the direction of seeming point (crosshair). A similar effect is achieved in the scripts of VR. On the first picture you can see two cameras (one is just a test added to the need for meaningful images) is closer to the camera child whose parent is a "bone head". The second is my camera. The problem comes when the movement of the head goes up and down my camera or loses correct position, or "falls" in the center of the head. (Other pictures) In addition, the problem arises in the course of an animation where the character is always changing position when it moves. The question is. :) Is there any way to simply "seeming synchronization" of these objects ??
Thank you for any help! (Current code)
#region New Test
x += mInputSource.ViewX * rotationSensitivity;
y = ClampAngle(y - mInputSource.ViewY * rotationSensitivity, _SmartMinPitch, _SmartMaxPitch);
// ScreenDebugHelper.AddScreenDebugerItem("x: ", x);
// ScreenDebugHelper.AddScreenDebugerItem("y: ", y);
// mDistance += (distanceTarget - mDistance) * zoomSpeed * rDeltaTime;
rotation = Quaternion.AngleAxis(x, Vector3.up) * Quaternion.AngleAxis(y, Vector3.right);
position = _SmartAnchor.position + rotation * (_SmartAnchorOffset - Vector3.forward * 0.01f); //mDistance
_Transform.position = position;
_Transform.rotation = rotation;
float correctionDistance = Vector3.Distance(distanceCorection, _SmartAnchor.position);
ScreenDebugHelper.AddScreenDebugerItem("Real distance: ", Vector3.Distance(distanceCorection, _SmartAnchor.position));
#endregion
Your answer
Follow this Question
Related Questions
Problem of stuttering FPS Camera 1 Answer
Networking Fps Cameras 0 Answers
fps script not working 1 Answer
Issue with Rigidbody2D (I think) 2 Answers
C# Camera based Recoil 0 Answers