slerp unity code example
Example 1: unity requirecomponent
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class PlayerScript : MonoBehaviour
{
Rigidbody rb; void Start()
{
rb = GetComponent<Rigidbody>();
} void FixedUpdate()
{
rb.AddForce(Vector3.up);
}
}
Example 2: setparent unity
using UnityEngine;public class ExampleClass : MonoBehaviour
{
public GameObject child; public Transform parent;
public void Example(Transform newParent)
{
child.transform.SetParent(newParent);
child.transform.SetParent(newParent, false);
child.transform.SetParent(null);
}
}