Exemplo n.º 1
0
        public static void CheckCameraCollision(Ped ped, Vector3 cameraFocusPos)
        {
            Vector3 castFrom = cameraFocusPos;
            float   distance;
            Vector3 castDir = -ped.Camera.transform.forward;

            // use distance from gun aiming offset ?
            if (ped.CurrentWeapon != null && ped.CurrentWeapon.GunAimingOffset != null)
            {
                //	Vector3 desiredCameraPos = this.transform.TransformPoint (- _player.CurrentWeapon.GunAimingOffset.Aim) + Vector3.up * .5f;
                //	Vector3 desiredCameraPos = this.transform.TransformPoint( new Vector3(0.8f, 1.0f, -1) );
                Vector3 desiredCameraPos = cameraFocusPos + ped.Camera.transform.TransformVector(ped.WeaponHolder.cameraAimOffset);
                Vector3 diff             = desiredCameraPos - castFrom;
                distance = diff.magnitude;
                castDir  = diff.normalized;
            }
            else
            {
                distance = ped.CameraDistance;
            }

            BaseScriptState.CheckCameraCollision(ped, castFrom, castDir, distance);
        }
Exemplo n.º 2
0
 public override void CheckCameraCollision()
 {
     BaseScriptState.CheckCameraCollision(m_ped, this.GetCameraFocusPos(), -m_ped.Camera.transform.forward,
                                          m_ped.CameraDistanceVehicle);
 }
 public virtual void CheckCameraCollision()
 {
     BaseScriptState.CheckCameraCollision(m_ped, this.GetCameraFocusPos(), -m_ped.Camera.transform.forward,
                                          this.GetCameraDistance());
 }