Exemple #1
0
 public void LookAt(SVector3 lookAtPoint)
 {
     SVector3 dir = lookAtPoint - position;
     //SVector3 norm = SVector3.Cross(forward, dir);
     if(dir.sqrtMagnitude < Fix64.One / (Fix64)10)
         return;
     
     SVector3 norm = SVector3.Cross(forward, dir);
     if(norm.sqrtMagnitude < Fix64.One / (Fix64)100 && SVector3.Dot(dir.normalized,forward) > (Fix64)0)
     {
         return;
     }
     else if(norm.sqrtMagnitude < Fix64.One / (Fix64)100 && SVector3.Dot(dir.normalized,forward) < (Fix64)0)
     {
         RotateAroundAxis(up, (Fix64)Fix64.Pi / (Fix64)2);
     }
     else
     {
         
         
         RotateAroundAxis(norm.normalized, SVector3.AngleFromTo(forward, dir));
     }
 }
Exemple #2
0
 public static SVector3 Cross(SVector3 a, SVector3 b)
 {
     return(a.Cross(b));
 }