private void Update() { PhysicsTracker.Update(transform.position, transform.rotation, Time.smoothDeltaTime); //If hand is blocked cannot do anything if (Blocked) { //Debug.Log("blocked"); HoveredInteractable = null; return; } //Interactions with attached grabbable objects, it blocks hover interactions if (AttachedGrabbable) { //Debug.Log("AttachedGrabbable: " + AttachedGrabbable); AttachedGrabbable.Interact(this); } //IMPORTANT can't be else if because need to hover Slots to be able to let Grabbables on Slots /*else*/ if (HoveredInteractable = HoverInteractableDetection()) { //Debug.Log("HoveredInteractable: " + HoveredInteractable); HoveredInteractable.Interact(this); } }
private void GetData() { CharacterVR = GetComponentInParent <CharacterVR>(); PhysicsTracker = new PhysicsTracker(); Collider = GetComponentInChildren <Collider>(); TrackedPoseDriver = GetComponent <TrackedPoseDriver>(); PoseProvider = GetComponent <PoseProvider>(); }
// Use this for initialization protected virtual void Start() { //Setup the transforms of the MSceneObject this.SetupTransform(); //Try to get the rigid body (if available) this.rigidBody = this.GetComponent <Rigidbody>(); //Add the physics properties if rigid body is available if (this.rigidBody != null) { this.MSceneObject.PhysicsProperties = new MPhysicsProperties() { Mass = this.rigidBody.mass, Inertia = this.rigidBody.inertiaTensor.ToList(), CenterOfMass = this.rigidBody.centerOfMass.ToList() }; //Create a new physics tracker to monitor potential changes with regard to physics this.physicsTracker = new PhysicsTracker(this.MSceneObject); } //Setup the collider and write the result to MSceneObject if (!this.IgnoreCollision) { this.SetupCollider(); } //Setup the mesh and write the result to MSceneObject if (this.TransferMesh) { this.SetupMesh(); } //Add the scene object to the scene access UnitySceneAccess.AddSceneObject(this.MSceneObject); }
private void Start() { PhysicsTracker.Reset(transform.position, transform.rotation, Vector3.zero, Vector3.zero); }