- Home /
Question by
theportalmasters · Jun 10, 2020 at 02:45 PM ·
cameravector3slerp
Adding a Vector3 disables movement of camera
I have a smoothed camera that works by taking a direction that you want to view an object from on the unit sphere, multiplying that by an offset, and adding the focus position to that. When at (0,0,0) it works just fine, but the moment it's moved from there, the camera has a bias toward the direction it been moved in. Can I make this not happen?
void RotateSmoothly()
{
//magenta
Vector3 smoothPosOnUnitSphere = Vector3.Slerp((transform.position - Vector3.zero).normalized, desiredPosOnUnitSphere, .1f).normalized;
Vector3 smoothePos = ShiftToFoucusPoint(smoothPosOnUnitSphere);
transform.position = smoothePos;
transform.LookAt(foucusPoint);
}
private Vector3 ShiftToFoucusPoint(Vector3 direction)
{
Vector3 UnUnit = direction.normalized * offset;
return UnUnit + foucusPoint;
}
Comment