lab3
This commit is contained in:
1 parent
a70076ebe9
commit
854835878c
20 files changed
+2542
No files matched your search
@@ -21,5 +21,27 @@ namespace Code.Base
|
||||
{
|
||||
return new Steering();
|
||||
}
|
||||
|
||||
public float MapToRange(float rotation)
|
||||
{
|
||||
rotation %= 360;
|
||||
|
||||
if (Mathf.Abs(rotation) <= 180) return rotation;
|
||||
|
||||
if (rotation < 0)
|
||||
rotation += 360;
|
||||
else
|
||||
rotation -= 360;
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public Vector3 GetOriAsVec(float orientation)
|
||||
{
|
||||
var vector = Vector3.zero;
|
||||
vector.x = Mathf.Sin(orientation * Mathf.Deg2Rad) * 1;
|
||||
vector.z = Mathf.Cos(orientation * Mathf.Deg2Rad) * 1;
|
||||
return vector.normalized;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user