13 [Obsolete(
"Body Locked Solvers are replaced by Orbital Solvers. Use the YawOnly/CameraAligned orientations and a World Offset to exactly replace SolverBodyLocked.",
false)]
30 #region public members 31 [Tooltip(
"The desired orientation of this object. Default sets the object to face the TrackedObject/TargetTransform. CameraFacing sets the object to always face the user.")]
33 [Tooltip(
"XYZ offset for this object in relation to the TrackedObject/TargetTransform")]
35 [Tooltip(
"RotationTether snaps the object to be in front of TrackedObject regardless of the object's local rotation.")]
36 public bool RotationTether =
false;
37 [Tooltip(
"TetherAngleSteps is the division of steps this object can tether to. Higher the number, the more snapple steps.")]
39 public int TetherAngleSteps = 6;
42 private Quaternion desiredRot = Quaternion.identity;
49 float targetYRotation = GetOrientationRef().eulerAngles.y;
50 float tetherYRotation = desiredRot.eulerAngles.y;
51 float angleDiff = Mathf.DeltaAngle(targetYRotation, tetherYRotation);
52 float tetherAngleLimit = 360f / TetherAngleSteps;
54 if (Mathf.Abs(angleDiff) > tetherAngleLimit)
56 int numSteps = Mathf.RoundToInt(targetYRotation / tetherAngleLimit);
57 tetherYRotation = numSteps * tetherAngleLimit;
58 desiredRot = Quaternion.Euler(0f, tetherYRotation, 0f);
63 Vector3 desiredPos = solverHandler.TransformTarget != null ? solverHandler.TransformTarget.position + (desiredRot * offset) : Vector3.zero;
65 GoalPosition = desiredPos;
66 GoalRotation = desiredRot;
68 UpdateWorkingPosToGoal();
69 UpdateWorkingRotToGoal();
72 private Transform GetOrientationRef()
78 return solverHandler.TransformTarget;
SolverBodyLock provides a solver that follows the TrackedObject/TargetTransform. Adjusting "LerpTime"...
override void SolverUpdate()