| 12345678910111213141516171819202122232425 |
- using UnityEngine;
- public class Mount : MonoBehaviour
- {
- public GameObject mountPoint;
- // Start is called once before the first execution of Update after the MonoBehaviour is created
- void Start()
- {
- if (mountPoint != null)
- {
- var rb = transform.parent.GetComponent<Rigidbody>();
- var diff = transform.position - mountPoint.transform.position;
- mountPoint.transform.parent.position += diff;
- mountPoint.transform.parent.rotation = transform.rotation;
- }
- }
- // Update is called once per frame
- void Update()
- {
- }
- }
|