/// <summary> Update this object's transform by applying a velocity to the rigidbody </summary> protected override void UpdatePosition() { if (trackingTarget != null) { if (this.physicsBody != null) { SG_Util.TransformRigidBody(ref physicsBody, this.TargetPosition, this.TargetRotation, rotationSpeed); if ((this.transform.position - trackingTarget.position).magnitude > resetDistance) { resetTimer += this.updateTime == UpdateDuring.FixedUpdate ? Time.fixedDeltaTime : Time.deltaTime; if (resetTimer >= resetTime) { base.UpdatePosition(); //snaps using simple method resetTimer = 0; } } else { resetTimer = 0; } } else { base.UpdatePosition(); } } }
/// <summary> Update this script's transform by applying a velocity to its rigidbody. </summary> public void UpdateTransformPhysics() { if (this.trackedObject != null && this.handRB != null) { SG_Util.TransformRigidBody(ref this.handRB, this.TargetPosition, this.TargetRotation, physRotationSpeed); } }