private void CalcuWhenObserveFreeMove(PlayerEntity playerEntity, FreeMoveEntity observedFreeMove) { var camera = playerEntity.cameraFinalOutputNew; var calsOut = playerEntity.cameraStateOutputNew; camera.EulerAngle = calsOut.ArchorEulerAngle + calsOut.EulerAngle; var rotation = Quaternion.Euler(camera.EulerAngle); var archorPos = observedFreeMove.position.Value + observeOffset; float actualDistance = CameraUtility.ScatterCast(archorPos, rotation, observeDistance, _samplePoints, _collisionLayers); var finalPostOffset = -rotation.Forward() * actualDistance; camera.Position = archorPos + finalPostOffset; }
private void CalcuFreeMovePos(FreeMoveEntity observedFreeMove, CameraFinalOutputNewComponent camera) { if (observedFreeMove == null || !observedFreeMove.hasPosition) { return; } var archorPos = observedFreeMove.position.Value + (observedFreeMove.hasFreeMoveController ? Vector3.zero : observeOffset); var rotation = Quaternion.Euler(camera.EulerAngle); if (observedFreeMove.hasFreeMoveController && observedFreeMove.freeMoveController.ControllType == (byte)EFreeMoveControllType.FixFocusPos) { camera.Position = archorPos; } else { float actualDistance = CameraUtility.ScatterCast(archorPos, rotation, observeDistance, _samplePoints, _collisionLayers); var finalPostOffset = -rotation.Forward() * actualDistance; camera.Position = archorPos + finalPostOffset; } }