Cum se face cu rotire pe o axă

newRotation = Quaternion. LookRotation # 40; transformare. poziția - țintă. poziție # 41; ;


Și să ne amintim clasa nepomnyukakoy, unde am învățat vectorul. Pentru a găsi un vector, trebuie să luați coordonatele începutului de la coordonatele sfârșitului. Trebuie să aveți un vector direcționat de la arma la țintă. Ie arma este începutul, iar scopul este sfârșitul. Și tu ai contrariul.






Și, în măsura în care știu, Vector3.x - numai pentru citire.
Încercați acest lucru:

void Update # 40; # 41;
# 123;
Quaternion endRotation = Quaternion. LookRotation # 40; țintă. pozitie - transformare. poziție # 41; ;
transformare. rotație = Quaternion. Slerp # 40; transformare. rotație. EndRotation, Time. deltaTime * 8 # 41; ;
# 125;


Înregistrat, verificat. Confirmați buna execuție.

Simmilliar a scris: Acest lucru ar trebui să traducă cvartnionul în grade
Acest lucru este invers


Mulțumesc.
Rotirea cursorului în jurul playerului spălate în jos prin hasurare în ecuația notebook linia de intersecție (2 puncte) și circumferința (centrat la primul punct) posokraschal Jumătate este pătrat prin înmulțirea variabilelor însele transformat în cele din urmă o astfel de piesă sălbatic. Dar lucrează la ura.

dacă # 40; țintă. transformare. poziție. z> RotationController. transformare. poziție. z # 41;
# 123;
zb = Mathf. sqrt # 40; r * r * # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; * # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; / # 40; # 40; țintă. transformare. poziție. y - RotationController. transformare. poziție. y # 41; * # 40; țintă. transformare. poziție. y - RotationController. transformare. poziție. y # 41; + # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; * # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; # 41; # 41; + Controlor de rotație. transformare. poziție. z;







dacă # 40; țintă. transformare. poziție. z # 123;
zb = - Mathf. sqrt # 40; r * r * # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; * # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; / # 40; # 40; țintă. transformare. poziție. y - RotationController. transformare. poziție. y # 41; * # 40; țintă. transformare. poziție. y - RotationController. transformare. poziție. y # 41; + # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; * # 40; țintă. transformare. poziție. z - RotationController. transformare. poziție. z # 41; # 41; # 41; + Controlor de rotație. transformare. poziție. z;

dacă # 40; țintă. transformare. poziție. y> RotationController. transformare. poziție. y # 41;
# 123;
yb = Mathf. sqrt # 40; r * r - # 40; zb - RotationController. transformare. poziție. z # 41; * # 40; zb - RotationController. transformare. poziție. z # 41; # 41; + Controlor de rotație. transformare. poziție. y;
# 125;

dacă # 40; țintă. transformare. poziție. y # 123;
yb = - Mathf. sqrt # 40; r * r - # 40; zb - RotationController. transformare. poziție. z # 41; * # 40; zb - RotationController. transformare. poziție. z # 41; # 41; + Controlor de rotație. transformare. poziție. y;
# 125;

Director. transformare. pozitie = Vector3 nou # 40; 0, yb, zb # 41; ;
Director. transformare. lookat # 40; RotationController. transformare. poziție # 41; ;

Text ascuns: arată

Un altul ar fi cineva lerp'om învățat să-l folosească pentru a încetini proiectilul. Ei bine, în baie, asta e rigidul tău







Articole similare

Trimiteți-le prietenilor: