Its a simple script I dont know where I’m going wrong I should know better
I’m trying to match one objects rotation with another. The script retrieves the rotation of the ship, which I have specified in the inspector and applies it to the object the script is applied to. No matter what I try, Ballrot always returns (0,0,0) no matter the rotation of the ship.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HorizonScript : MonoBehaviour
{
private Quaternion BallRot;
public Transform ParentShip;
private void HorizonRot()
{
ParentShip = GetComponent<Transform>();
BallRot = ParentShip.transform.rotation;
Debug.Log(BallRot);
this.transform.rotation = BallRot;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
HorizonRot();
}
}
im stumped
cheers