Game Development Reference
In-Depth Information
(0, currentAngle, 0);
_cameraTransform.position = targetCenter;
_cameraTransform.position += currentRotation *
Vector3.back * distance;
var newCameraPos : Vector3 =
_cameraTransform.position;
newCameraPos.y = currentHeight;
_cameraTransform.position = newCameraPos;
SetUpRotation(targetCenter);
}
// C# user:
void LateUpdate () {
Vector3 targetCenter = _targetTransform.position +
_centerOffset;
float originalTargetAngle =
_targetTransform.eulerAngles.y;
float currentAngle = _cameraTransform.eulerAngles.y;
float targetAngle = originalTargetAngle;
if (AngleDistance (currentAngle, targetAngle) > 160
&& _characterControl.IsMoveBackward) {
targetAngle += 180;
}
currentAngle = Mathf.SmoothDampAngle(currentAngle,
targetAngle, ref _angleVelocity, smoothTime,
maxSpeed);
_targetHeight = targetCenter.y + height;
float currentHeight = _cameraTransform.position.y;
currentHeight = Mathf.SmoothDamp (currentHeight,
_targetHeight, ref _heightVelocity, heightSmoothTime);
Quaternion currentRotation = Quaternion.Euler (0,
currentAngle, 0);
_cameraTransform.position = targetCenter;
_cameraTransform.position += currentRotation *
Vector3.back * distance;
Vector3 newCameraPos = _cameraTransform.position;
newCameraPos.y = currentHeight;
_cameraTransform.position = newCameraPos;
Search WWH ::




Custom Search