Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        lastLaserMode = DataLoader.Settings.Lasermode;

        this.Head = GameObject.Find("Camera (head)");

        HOTK_Overlay overlay = GetComponent <HOTK_Overlay>();

        OwnOverlay = overlay;
        if (overlay.AnchorDevice == HOTK_Overlay.AttachmentDevice.LeftController)
        {
            this.Hand = GameObject.Find("Controller (left)");
        }
        else if (overlay.AnchorDevice == HOTK_Overlay.AttachmentDevice.RightController)
        {
            this.Hand = GameObject.Find("Controller (right)");
        }
        else
        {
            Debug.LogError("Hand billboard on wrong object");
            Debug.Assert(false);
        }
        Device = Hand.GetComponent <HOTK_TrackedDevice>();

        ButtonOverlay = ButtonOverlayObject.GetComponent <HOTK_Overlay>();
        HandOverlay   = HandOverlayObject.GetComponent <HOTK_Overlay>();

        HandComponents components = new HandComponents(this.Hand, this);

        DataLoader.HandComponents.Add(components);

        UpdateLaserMode();
    }
Exemplo n.º 2
0
    public void Initialize(
        HandComponents handComponents,
        HandBonesTransformations transformations)
    {
        this.transformations = transformations;

        components = handComponents;

        status = HandInteractionStatus.None;

        timeHolding      = 0;
        gameObjectInHand = null;

        momentum = new HandMomentum
        {
            LinearVelocity      = new Vector3(),
            LinearAcceleration  = new Vector3(),
            AngularVelocity     = new Vector3(),
            AngularAcceleration = new Vector3()
        };

        bannedGameObjects = new List <GameObject>();

        DeactivateColliders();
    }
    private void BuildComponents(
        OvrAvatarPhysicsHand hand,
        OvrAvatarPhysicsHandTypes.HandType type,
        GameObject ovrAvatarComponent)
    {
        var transformations = CreateHandTransformations(type, ovrAvatarComponent);

        hand.gameObject.transform.localPosition = transformations.handBegin.transform.localPosition;
        hand.gameObject.transform.localRotation = transformations.handBegin.transform.localRotation;

        var handComponents = new HandComponents
        {
            indexComponent = BuildIndexFinger(hand, transformations.indexFingerBegin, transformations.indexFingerEnd),
            thumbComponent = BuildThumb(hand, transformations.thumbFingerBegin, transformations.thumbFingerEnd),
            fistComponent  = BuildFist(hand, transformations.handBegin, transformations.grip)
        };

        hand.Initialize(handComponents, transformations);
    }