public Vec3 Closest(Vec3 to) => NativeAPI.plane_point_closest(this, to);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr mesh_gen_rounded_cube(Vec3 dimensions, float edge_radius, int subdivisions);
/// <summary>Basic initialization constructor! Just copies in the provided values directly.</summary> /// <param name="x">X location of the pose.</param> /// <param name="y">Y location of the pose.</param> /// <param name="z">Z location of the pose.</param> /// <param name="orientation">Orientation of the pose, stored as a rotation from Vec3.Forward.</param> public Pose(float x, float y, float z, Quat orientation) { this.position = new Vec3(x, y, z); this.orientation = orientation; }
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern Quat quat_euler(Vec3 euler_degrees);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern Vec3 quat_mul_vec(ref Quat a, ref Vec3 b);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void solid_teleport(IntPtr solid, ref Vec3 position, ref Quat rotation);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void render_set_light(ref Vec3 direction, float intensity, ref Color color);
public bool Intersect(Ray ray, out Vec3 at) => NativeAPI.bounds_ray_intersect(this, ray, out at);
public bool Contains(Vec3 pt) => NativeAPI.bounds_point_contains(this, pt);
/// <summary>Create a bounding box from a corner, plus box dimensions.</summary> /// <param name="bottomLeftBack">The -X,-Y,-Z corner of the box.</param> /// <param name="dimensions">The total dimensions of the box.</param> /// <returns>A Bounds object that extends from bottomLeftBack to bottomLeftBack+dimensions.</returns> public static Bounds FromCorner(Vec3 bottomLeftBack, Vec3 dimensions) => new Bounds(bottomLeftBack + dimensions / 2, dimensions);
/// <summary>Create a bounding box between two corner points.</summary> /// <param name="bottomLeftBack">The -X,-Y,-Z corner of the box.</param> /// <param name="topRightFront">The +X,+Y,+Z corner of the box.</param> /// <returns>A Bounds object that extends from bottomLeftBack to topRightFront.</returns> public static Bounds FromCorners(Vec3 bottomLeftBack, Vec3 topRightFront) => new Bounds(bottomLeftBack / 2 + topRightFront / 2, topRightFront - bottomLeftBack);
/// <summary>Creates a bounding box object centered around zero!</summary> /// <param name="totalDimensions">The total size of the box, from one end to the /// other. This is the width, height, and depth of the Bounds.</param> public Bounds(Vec3 totalDimensions) { this.center = Vec3.Zero; dimensions = totalDimensions; }
/// <summary>Creates a bounding box object!</summary> /// <param name="center">The exact center of the box.</param> /// <param name="totalDimensions">The total size of the box, from one end to the /// other. This is the width, height, and depth of the Bounds.</param> public Bounds(Vec3 center, Vec3 totalDimensions) { this.center = center; dimensions = totalDimensions; }
public HandJoint(Vec3 position, Quat orientation, float radius) { this.position = position; this.orientation = orientation; this.radius = radius; }
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void solid_add_box(IntPtr solid, ref Vec3 dimensions, float kilograms, ref Vec3 offset);
public bool Contains(Vec3 linePt1, Vec3 linePt2) => NativeAPI.bounds_line_contains(this, linePt1, linePt2);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void solid_add_capsule(IntPtr solid, float diameter, float height, float kilograms, ref Vec3 offset);
/// <summary>Does the bounds contain or intersect with the given /// capsule?</summary> /// <param name="linePt1">Start of the capsule.</param> /// <param name="linePt2">End of the capsule</param> /// <param name="radius">Radius of the capsule.</param> /// <returns>True if the capsule is in, or intersects with the /// bounds.</returns> public bool Contains(Vec3 linePt1, Vec3 linePt2, float radius) => NativeAPI.bounds_capsule_contains(this, linePt1, linePt2, radius);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void solid_set_velocity_ang(IntPtr solid, ref Vec3 radians_per_second);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void transform_set(IntPtr transform, ref Vec3 position, ref Vec3 scale, ref Quat rotation);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern Quat quat_lookat(Vec3 from, Vec3 at);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern void transform_lookat(IntPtr transform, ref Vec3 at);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern int ui_affordance(string text, ref Pose movement, Vec3 at, Vec3 size);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern Vec3 transform_world_to_local(IntPtr transform, ref Vec3 world_coordinate);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr mesh_gen_cube(Vec3 dimensions, int subdivisions = 0);
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern Vec3 transform_local_to_world_dir(IntPtr transform, ref Vec3 local_direction);
/// <summary>Basic initialization constructor! Just copies in the provided values directly.</summary> /// <param name="position">Location of the pose.</param> /// <param name="orientation">Orientation of the pose, stored as a rotation from Vec3.Forward.</param> public Pose(Vec3 position, Quat orientation) { this.position = position; this.orientation = orientation; }
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr solid_create(ref Vec3 position, ref Quat rotation, SolidType type = SolidType.Normal);
public Matrix ToMatrix(Vec3 scale) => NativeAPI.pose_matrix(this, scale);
public bool Intersect(Vec3 lineStart, Vec3 lineEnd, out Vec3 at) => NativeAPI.plane_line_intersect(this, lineStart, lineEnd, out at);