This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExecuteAlways] | |
public class Avoidance : MonoBehaviour | |
{ | |
public float avoidanceFactor = 1f; | |
public float sensorLength = 20; | |
public float sensorThickness = 2; | |
public float sensorOffset = 5; | |
public float horizontalAngle = 23; | |
public float upAngle = 23; | |
public float downAngle = 23; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sensor : MonoBehaviour | |
{ | |
public CapsuleCollider Collider; | |
public LayerMask Mask ; | |
void OnValidate() | |
{ | |
Asr.IsTrue(Mask.value != 0); | |
Asr.IsTrue(Collider); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Serializable] | |
public struct AffineTransform | |
{ | |
public Vector3 translation; | |
public Quaternion rotation; | |
public AffineTransform(Vector3 t, Quaternion r) | |
{ | |
translation = t; | |
rotation = r; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class QuaternionExt { | |
const float Tolerance = 1e-10f; | |
public static readonly Quaternion zero = new Quaternion(0f, 0f, 0f, 0f); | |
public static Quaternion FromToRotation(Vector3 from, Vector3 to) { | |
float theta = Vector3.Dot(from.normalized, to.normalized); | |
if (theta >= 1f) | |
return Quaternion.identity; | |
if (theta <= -1f) { |
NewerOlder