public override void TrackBegin(Grabber grabber, GrabPointProvider pointProvider) { Rigidbody.isKinematic = GrabFlags.HasFlag(EGrabPhysicsFlags.IsKinematic); Rigidbody.detectCollisions = GrabFlags.HasFlag(EGrabPhysicsFlags.Collision); Rigidbody.useGravity = GrabFlags.HasFlag(EGrabPhysicsFlags.UseGravity); Rigidbody.velocity = Vector3.zero; Rigidbody.angularVelocity = Vector3.zero; }
public override void TrackBegin(Grabber grabber, GrabPointProvider pointProvider) { _parent = transform.parent; if (ParentToPoint) { transform.SetParent(pointProvider.Point); } }
public override void TrackEnd(Grabber grabber, GrabPointProvider pointProvider) { Rigidbody.isKinematic = UnGrabFlags.HasFlag(EGrabPhysicsFlags.IsKinematic); Rigidbody.detectCollisions = UnGrabFlags.HasFlag(EGrabPhysicsFlags.Collision); Rigidbody.useGravity = UnGrabFlags.HasFlag(EGrabPhysicsFlags.UseGravity); if (ThrowSensitivity > 0) { var velocity = grabber.VelocityEstimator.Velocity; Rigidbody.velocity = velocity * ThrowSensitivity; } }
public override void Track(Grabber grabber, GrabPointProvider pointProvider) { if (ParentToPoint) { return; } var point = pointProvider.Point; transform.position = point.position; transform.rotation = point.rotation; }
public override void Track(Grabber grabber, GrabPointProvider pointProvider) { var point = pointProvider.Point; var direction = point.position - transform.position; direction.Normalize(); var distance = Vector3.Distance(transform.position, point.position); var outputSpeed = Mathf.Lerp(0, Speed, Curve.Evaluate(distance)); Rigidbody.position += direction * outputSpeed * Time.fixedDeltaTime; if (SyncRotation) { Rigidbody.rotation = point.rotation; } }
public abstract void TrackBegin(Grabber grabber, GrabPointProvider pointProvider);
public override void TrackEnd(Grabber grabber, GrabPointProvider pointProvider) { transform.SetParent(_parent); }