add overlapBox/Sphere/Capsule function, fixed OnWake/OnSleep not work
This commit is contained in:
@ -46,6 +46,25 @@ namespace Prism
|
||||
Z = Mathf.Clamp(Z, min.Z, max.Z);
|
||||
}
|
||||
|
||||
public float Length()
|
||||
{
|
||||
return (float)Math.Sqrt(X * X + Y * Y + Z * Z);
|
||||
}
|
||||
|
||||
public Vec3 Normalized()
|
||||
{
|
||||
float length = Length();
|
||||
return new Vec3(X / length, Y / length, Z / length);
|
||||
}
|
||||
|
||||
public void Normalize()
|
||||
{
|
||||
float length = Length();
|
||||
X = X / length;
|
||||
Y = Y / length;
|
||||
Z = Z / length;
|
||||
}
|
||||
|
||||
|
||||
public Vec2 XY {
|
||||
get { return new Vec2(X, Y); }
|
||||
@ -79,6 +98,11 @@ namespace Prism
|
||||
return new Vec3(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
|
||||
}
|
||||
|
||||
public static Vec3 operator +(Vec3 left, float right)
|
||||
{
|
||||
return new Vec3(left.X + right, left.Y + right, left.Z + right);
|
||||
}
|
||||
|
||||
public static Vec3 operator -(Vec3 left, Vec3 right)
|
||||
{
|
||||
return new Vec3(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
|
||||
|
||||
Reference in New Issue
Block a user