Пример #1
0
 // Start is called before the first frame update
 void Awake()
 {
     _grabObjController = gameObject.GetComponent <GrabObjController>();
     _forceManipulation = gameObject.GetComponent <ForceManipulation>();
     _forceGesture      = gameObject.GetComponent <ForceGestureHand>();
     _climbHand         = gameObject.GetComponent <ClimbHand>();
     HandSource         = _grabObjController.HandSource;
 }
 public void DropHand(GameObject climbHand)
 {
     if (_currentHand == climbHand.GetComponent <ClimbHand>())
     {
         _currentHand = null;
         _cameraRig.GetComponent <Rigidbody>().useGravity = true;
         _playerController.CanMove = true;
     }
 }
    private void UpdateClimbPosition(ClimbHand climbHand)
    {
        //This will be weird: _cameraRig.GetComponent<Rigidbody>().MovePosition(_cameraRig.transform.position + climbHand.ControllerDelta * ClimbingSpeed * Time.fixedDeltaTime);
        Vector3 movement = Vector3.zero;

        movement += climbHand.ControllerDelta * ClimbingSpeed;
        //print(climbHand.gameObject+ " " + climbHand.ControllerDelta);
        _cameraRig.GetComponent <Rigidbody>().MovePosition(_cameraRig.transform.position + movement * Time.fixedDeltaTime);
        //_cameraRig.GetComponent<Rigidbody>().velocity = (_cameraRig.transform.position + climbHand.ControllerDelta * ClimbingSpeed * Time.fixedDeltaTime);
    }
 public void StartClimbObject(GameObject climbHand)
 {
     _currentHand = climbHand.GetComponent <ClimbHand>();
     if (_cameraRig.GetComponent <Rigidbody>().useGravity)
     {
         _cameraRig.GetComponent <Rigidbody>().velocity   = Vector3.zero;
         _cameraRig.GetComponent <Rigidbody>().useGravity = false;
     }
     if (_playerController.CanMove)
     {
         _playerController.CanMove = false;
     }
 }
 // Start is called before the first frame update
 void Awake()
 {
     if (!_playerController)
     {
         _playerController = GetComponent <VRPlayerController>();
     }
     if (!_rightHand)
     {
         _rightHand = _playerController.RightHand;
     }
     if (!_leftHand)
     {
         _leftHand = _playerController.LeftHand;
     }
     _rightGestureHand = _rightHand.GetComponent <ForceGestureHand>();
     _leftGestureHand  = _leftHand.GetComponent <ForceGestureHand>();
     _rightClimbHand   = _rightHand.GetComponent <ClimbHand>();
     _leftClimbHand    = _leftHand.GetComponent <ClimbHand>();
 }