Scripting API

Scripting API

MeshShape3D

Class in Abyss.Physics3D, from Abyss.Physics3D.

A Mesh Collider 3D's shape of a mesh's data, worked out ahead — on whatever thread a game's generation runs on — and handed to Physics 3D with the mesh in one call (Physics3D.CreateMesh, Physics3D.UpdateMesh), so the physics step makes nothing of it: a block world's chunk built whole, mesh and collider, away from the game.

public sealed class MeshShape3D : IDisposable

Remarks

Without one a Mesh Collider 3D's shape is made of its mesh's data in the physics step that first asks for it, on the engine thread — a millisecond or so for a chunk — as before.

Its triangles are always worked out, for a collider on ground or a Static or Kinematic body; its hull, the smallest convex shape round it, where hull says so, for a collider that is Convex, a trigger, or on a Dynamic body. A part not worked out is made as a collider first asks for it, as before.

Handed over, it is Physics 3D's; one never handed over is let go of with MeshShape3D.Dispose, or by the collector.

Properties

IsHandedOver

public bool IsHandedOver { get; }

Whether it has been handed over to Physics 3D, or let go of: either way it is no longer the caller's to hand.

Methods

Prepare

public static MeshShape3D Prepare(in MeshData data, bool hull = false)

The shape of data's triangles, worked out now, on this thread — and its hull too, where hull says so. Any thread, as many at once as there are threads.

Parameters

  • data: The mesh's corners and triangles, as World.CreateMesh takes them; its normals and texture coordinates play no part.
  • hull: Whether its hull is worked out too, for a collider that is Convex, a trigger, or on a Dynamic body.

Exceptions

  • ArgumentException: The data is not whole triples, names a corner it does not have, or its triangles make no shape.

Dispose

public void Dispose()

Lets go of it, where it was never handed over.