'Unity - why Rotation in Unity different from when rendering from the image target
I'm new to Unity. I'd like to develop an AR solar system that could render the entire solar system on the image target when scanning the image target. I'm having a problem where the planet (child) rotates correctly around the sun (parent) in Unity, but when I built it on my phone and went to scan it to render it on the image target, it didn't rotate correctly (different direction, axis). Hope someone could explain to me the problems and could show me the correct code for this. It will be a great help. Thank you. Sorry for the poor English.
This figure shows how the solar system is rotating in Unity. It is all rotated on the orbital path. When in Unity
This figure shows how the solar system is rotating when in the real world. It is all not orbiting around the sun in the right manner. when rendered on the image target
Here is the code for the orbit script.
{
public Transform aroundBody;
public float orbitPeriod = 27.3f;
private MasterControl control;
void Start()
{
GameObject controller = GameObject.Find("GameController");
control = controller.GetComponent<MasterControl>();
}
// Update is called once per frame
void Update()
{
float deltaAngle = (360.0f / (control.gametimePerDay * orbitPeriod)) * Time.deltaTime;
transform.RotateAround(aroundBody.position, Vector3.up, deltaAngle);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
