private void Start() { m_currentState = State.Free; CollisionHandler.Initialize(Camera.main); CollisionHandler.UpdateCameraClipPoints(transform.position, transform.rotation, ref CollisionHandler.AdjustedCameraClipPoints); CollisionHandler.UpdateCameraClipPoints(m_finalPosition, transform.rotation, ref CollisionHandler.DesiredCameraClipPoints); }
// Initialize private void Start() { // Components _target = GameObject.Find("yBot/Follow").transform as Transform; // Initialize moveToTarget(); _collisionHandler.Initialize(Camera.main); _collisionHandler.UpdateCameraClipPoints(transform.position, transform.rotation, ref _collisionHandler.AdjustedCameraClipPoints); _collisionHandler.UpdateCameraClipPoints(_destination, transform.rotation, ref _collisionHandler.DesiredCameraClipPoints); }
// Update is called once per frame void Update() { destination = target.position - transform.forward * distanceFromTarget; // used for shooting raycasts to check for collision collision.UpdateCameraClipPoints(destination, transform.rotation, ref collision.desiredCameraClipPoints); // currently used for debugging adjusted camera position after collision collision.UpdateCameraClipPoints(transform.position, transform.rotation, ref collision.adjustedCameraClipPoints); //draw debug lines for (int i = 0; i < 5; i++) { if (drawDesiredCollisionLines) { Debug.DrawLine(target.position, collision.desiredCameraClipPoints[i], Color.magenta); } if (drawAdjustedCollisionLines) { Debug.DrawLine(target.position, collision.adjustedCameraClipPoints[i], Color.cyan); } } CamControl(); }