VoxelMesh
An Entity can have a single physical representation. VoxelMesh represents a mesh made of voxels, created within the Crayta editor. VoxelMesh derives from Entity so if you have a VoxelMesh you can do any of these functions as well as the functions in Entity. You can do entity:IsA(VoxelMesh) to see if a particular entity variable is a VoxelMesh type entity.
Parent: Entity
Functions
Function Name |
Usage |
Description |
Notes |
SetVoxel |
voxelComponent:SetVoxel(Vector pos, VoxelAsset voxelAsset) |
Change a single voxel in world space. |
Server Only |
SetVoxelBox |
voxelComponent:SetVoxelBox(Vector pos, Vector dimensions, VoxelAsset voxelAsset) |
Change a cuboid of voxels with given dimensions in world units (centimeters). 1 voxel = 25cm. |
Server Only |
SetVoxelBox |
voxelComponent:SetVoxelBox(Vector pos, number halfSize, VoxelAsset voxelAsset) |
Change a cube of voxels with a given half-size in world units (centimeters) for each axis. 1 voxel = 25cm. |
Server Only |
SetVoxelSphere |
voxelComponent:SetVoxelSphere(Vector pos, Vector dimensions, VoxelAsset voxelAsset) |
Change an elipsoid of voxels with given dimensions in world units (centimeters). 1 voxel = 25cm. |
Server Only |
SetVoxelSphere |
voxelComponent:SetVoxelSphere(Vector pos, number radius, VoxelAsset voxelAsset) |
Change a sphere of voxels with a given radius in world units (centimeters). 1 voxel = 25cm. |
Server Only |
ResetVoxels |
voxelComponent:ResetVoxels() |
Reset any SetVoxel...() calls that have been done during play, returning the voxel prop to its starting state (ie as it was in the editor). |
Server Only |
CreateThruster |
Thruster voxels:CreateThruster() |
Add a thruster to an entity |
|
CreateRelativeThruster |
Thruster voxels:CreateRelativeThruster() |
Add a thruster to an entity |
|
DestroyThruster |
voxels:DestroyThruster(Thruster handle) |
Destroy a thruster |
|
AddImpulse |
voxels:AddImpulse(Vector impulse) |
Add Impulse. An integral of force over a time interval. Newton seconds. |
|
AddAngularImpulse |
voxels:AddAngularImpulse(Rotation angularImpulse) |
Add an angular impulse. An integral of torque over a time interval. Newton seconds. |
|
Parameters
Parameter Name |
Usage |
Description |
Notes |
mesh |
voxelmesh mesh |
Get or change the voxel mesh asset |
|
collisionEnabled |
bool collisionEnabled |
Turn on or off collision (ie calling entry point OnCollision). |
|
damageEnabled |
bool damageEnabled |
Turn on or off damage (ie calling of entry point OnDamaged). |
|
physicsEnabled |
bool physicsEnabled |
Turn on or off physics. |
|
gravityEnabled |
bool gravityEnabled |
Turn on or off physics. |
|
onCollision |
Event onCollision |
Called when this entity is collided with by a player Character with the Character passed as an argument, as well as the voxel mesh Entity from which the onCollision event was sent. An alternative to listening for OnCollision in a script on the entity. |
|
onDamage |
Event onDamage |
Called when this entity is damaged with the amount of damage, the entity causing the damage and a HitResult structure, as well as the voxel mesh Entity from which the onDamage event was sent. An alternative to listening for OnDamage in a script on the entity. |
|
Overrides
Override Name |
Usage |
Description |
Notes |
new_index |
voxelMesh.var = object value |
|
|