Revert "Merge pull request 'find-the-sweet-spot' (#13) from find-the-sweet-spot into main"
This reverts commit5b8e4eaeac, reversing changes made to03c0b158a4.
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class TeleportOnTrigger : MonoBehaviour
|
||||
{
|
||||
[Header("Teleport Target")]
|
||||
public Transform targetPosition;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (targetPosition == null) return;
|
||||
|
||||
Rigidbody rb = other.attachedRigidbody;
|
||||
|
||||
if (rb != null)
|
||||
{
|
||||
// STOP ALL MOTION
|
||||
rb.linearVelocity = Vector3.zero;
|
||||
rb.angularVelocity = Vector3.zero;
|
||||
|
||||
// TELEPORT
|
||||
rb.position = targetPosition.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-physics objects
|
||||
other.transform.position = targetPosition.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user