protected virtual void UpdateAngularVelocity(InteractionSourcePose pose)
        {
            Vector3 newAngularVelocity;

            if (pose.TryGetAngularVelocity(out newAngularVelocity))
            {
                angularVelocity = newAngularVelocity;
            }
        }
Beispiel #2
0
    public static bool TryGetThrownObjectVelAngVel(InteractionSourcePose throwingControllerPose, Vector3 thrownObjectCenterOfMass, out Vector3 objectVelocity, out Vector3 objectAngularVelocity)
    {
        Vector3 controllerPos, controllerVelocity, controllerAngularVelocity;

        if (!throwingControllerPose.TryGetPosition(out controllerPos) ||
            !throwingControllerPose.TryGetVelocity(out controllerVelocity) ||
            !throwingControllerPose.TryGetAngularVelocity(out controllerAngularVelocity))
        {
            objectVelocity = objectAngularVelocity = default(Vector3);
            return(false);
        }

        GetThrownObjectVelAngVel(controllerPos, controllerVelocity, controllerAngularVelocity, thrownObjectCenterOfMass, out objectVelocity, out objectAngularVelocity);
        return(true);
    }
Beispiel #3
0
    public static ControllerReleaseData GetThrowReleasedVelocityAndAngularVelocity(this Rigidbody _rigidbody, Vector3 centerOfMassOfRigidbody, InteractionSourcePose poseInfo)
    {
        Vector3 setVel                    = default(Vector3);
        Vector3 angVel                    = default(Vector3);
        Vector3 controllerPos             = default(Vector3);
        Vector3 controllerVelocity        = default(Vector3);
        Vector3 controllerAngularVelocity = default(Vector3);

        poseInfo.TryGetPosition(out controllerPos);
        poseInfo.TryGetVelocity(out controllerVelocity);
        poseInfo.TryGetAngularVelocity(out controllerAngularVelocity);
        float dist = Vector3.Distance(centerOfMassOfRigidbody, controllerPos);

        //vel = velocityOfController + angularVelOfController * distBetween grabbable center of mass and controllerPos;
        //setVel = controllerVelocity + controllerAngularVelocity + (controllerAngularVelocity *-1) * dist;
        setVel = controllerVelocity;
        Debug.Log(" SetVal = ControllerVelocity ( " + controllerVelocity + ") controllerAngVel ((" + controllerAngularVelocity + ") * -1 )" + "  * dist (" + dist + ")");

        return(new ControllerReleaseData(setVel, angVel));
    }
Beispiel #4
0
        void updatePose(InteractionSourcePose pose)
        {
            Vector3    angularVelocity, gripPosition, pointerPosition, pointerForward, gripForward;
            Quaternion gripRotation, pointerRotation;

            if (pose.TryGetPosition(out gripPosition, InteractionSourceNode.Grip))
            {
                _currentState.GripPosition = gripPosition;
            }

            if (pose.TryGetPosition(out pointerPosition, InteractionSourceNode.Pointer))
            {
                _currentState.PointerPosition = pointerPosition;
            }

            if (pose.TryGetRotation(out pointerRotation, InteractionSourceNode.Pointer))
            {
                _currentState.PointerRotation = pointerRotation;
            }


            if (pose.TryGetRotation(out gripRotation, InteractionSourceNode.Grip))
            {
                _currentState.GripRotation = gripRotation;
            }

            if (pose.TryGetForward(out pointerForward, InteractionSourceNode.Pointer))
            {
                _currentState.PointerForward = pointerForward;
            }

            if (pose.TryGetAngularVelocity(out angularVelocity))
            {
                _currentState.AngularVelocity = angularVelocity;
            }
        }