简体   繁体   中英

Theta, Phi to Quaternion rotation Unity3D C#

I'm trying to rotate an object in the direction of a given angle that I have Theta & Phi values for. How does this apply when using something like

Vector3 rayRotate = new Vector3 (theta, phi, 0);
beamContainer.transform.rotation = Quaternion.Euler(rayRotate);

Should theta & phi be used directly on the X/Y or do I need to be running a Sin/Cos formula on them?

I have been trying all sort of combinations and varions but I can not get beamContainer pointing in the direction and have this aligned with the object that should be pointing that direction,

我能够解决问题,并通过以下方式将beamContainer旋转至所需方向:

beamContainer.transform.rotation = Quaternion.Euler(-90 + phi, -theta, 0f);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM