private void setRotation(Transform obj, bool trackingEngaged) { if (obj != null) { if (trackingEngaged) { Vector3 vectorToTarget = obj.position - transform.position; transform.rotation = CalcObject.VectorToRotationSlerp(transform.rotation, vectorToTarget, TrackRotationSpeed); } } }
void FixedUpdate() { if (!CenterMassPivot) { return; } if (rotationSpeed + rotationSpeedRange > 0) { Utilities.Warn("WARNING: Rotation Greater Than 0 May Conflict with CenterMassPivot", this.gameObject.name); } transform.rotation = CalcObject.VectorToRotationSlerp(transform.rotation, body.velocity, PivotRotationSpeed); }
private void setRotation(bool trackingEngaged) { if (RotationType == HomingRotation.Tracking) { if (trackingEngaged) { Vector3 direction = (Vector2)transform.position - prevShotPos; transform.rotation = CalcObject.VectorToRotationSlerp(transform.rotation, direction, TrackRotationSpeed); } else { transform.rotation = CalcObject.VectorToRotationSlerp(transform.rotation, Trajectory, TrackRotationSpeed); } } }