Class Primitive3DEntityOptions
Option set for creating a 3D primitive entity (cube, sphere, capsule, plane, etc.).
public class Primitive3DEntityOptions : PrimitiveEntityOptionsBase
- Inheritance
-
Primitive3DEntityOptions
- Derived
- Inherited Members
Remarks
Extends PrimitiveEntityOptionsBase with a size override. If Size is not provided, the primitive factory chooses shape‑specific defaults (e.g., unit cube, radius 0.5 sphere).
Properties
Size
Gets or sets the desired size/dimensions for the 3D primitive model. When null, the creation helper
applies shape‑specific default dimensions.
public Vector3? Size { get; set; }
Property Value
Examples
A sphere one unit across, and a cube one unit across:
game.Create3DPrimitive(PrimitiveModelType.Sphere, new() { Size = new Vector3(0.5f) }); // radius
game.Create3DPrimitive(PrimitiveModelType.Cube, new() { Size = new Vector3(1f) }); // full extent
Remarks
How this value is read depends on the primitive, and the conventions differ. Box-like shapes take full extents, while round shapes take a radius - that is, a half extent. Passing a diameter to a sphere therefore produces a model twice the intended size.
| Primitive | Interpretation |
|---|---|
| Cube, RectangularPrism, TriangularPrism | Full extent along each axis. |
| Plane, InfinitePlane | X and Z are the full extents. |
| Sphere | X is the radius. |
| Capsule | X is the radius, Y the length of the cylindrical section. |
| Cylinder | X is the radius, Z the height. |
| Cone | X is the radius, Y the height. |
| Torus | X is the major radius, Y the thickness. |
| Teapot | X is a uniform size. |
The generated model and the generated physics collider read this value the same way, so a primitive created with a collider always matches its mesh. They can only disagree if a collider is supplied by hand, in which case it must follow the same convention as the row above.