VR4Medical/ICI/Library/PackageCache/com.unity.xr.openxr@3903c1059bcf/Samples~/MeshingFeature/FallingSphere.cs
2025-07-29 13:45:50 +03:00

35 lines
838 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEngine.XR.OpenXR.Samples.MeshingFeature
{
public class FallingSphere : MonoBehaviour
{
private Vector3 starting;
private Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
starting = transform.position;
}
// Update is called once per frame
void FixedUpdate()
{
if (transform.position.y < -10)
{
#if UNITY_6000_0_OR_NEWER
rb.linearVelocity = Vector3.zero;
#else
rb.velocity = Vector3.zero;
#endif
rb.angularVelocity = Vector3.zero;
rb.MovePosition(starting);
}
}
}
}