reckfellENGINE

VoxelInstanceLibraryItem

Settings for a model that can be used by VoxelInstancer

On this page
class VoxelInstanceLibraryItemReckfellSharpInherits Resource

Settings for a model that can be used by VoxelInstancer

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties6

FloatingSdfOffsetAlongNormalProperty
# FloatingSdfOffsetAlongNormal
C#
public float FloatingSdfOffsetAlongNormal { get; set; }

Offset along instances upward axis to apply when the object is tested for being floating or not. An instance is determined to be floating if the SDF at its origin is greater than 0. However, in practice, SDF can be imprecise, and the way instances spawn on triangles of meshes means SDF at their position will always fluctuate a bit around 0. This can lead instances to be overly removed after digging around them, or not enough. You can attempt to fix this by increasing this offset to very small values, so SDF slightly below instances (usually underground) is tested instead. Negative values will check below, positive will check above. Make sure to test resulting behaviors. WARNING: changing this too high can break automatic removal entirely, but is relatively safer than VoxelInstanceLibraryItem.FloatingSdfThreshold.

FloatingSdfThresholdProperty
# FloatingSdfThreshold
C#
public float FloatingSdfThreshold { get; set; }

Threshold used to find if SDF is air. If the SDF at the sampled location is greater, the instance is considered floating. See also VoxelInstanceLibraryItem.FloatingSdfOffsetAlongNormal for more info. WARNING: changing this too high can break automatic removal entirely. While this can "turn off" removal after digging ground, it is not recommended to do this when instances have no collider, because then it leaves no way of removing them.

GeneratorProperty
# Generator
C#
public VoxelInstanceGenerator Generator { get; set; }

Generator that will be used to pick points where the item will spawn.

LodIndexProperty
# LodIndex
C#
public int LodIndex { get; set; }

LOD index of chunks of the terrain where this item will spawn. The higher it is, the broader the range it will spawn at around viewers, however it will have lower precision because it uses meshes of a lower level of detail. Prefer spawning larger objects on higher LOD indexes (large trees, boulders), and small objects on lower LOD indexes (grass, small rocks)

NameProperty
# Name
C#
public string Name { get; set; }
PersistentProperty
# Persistent
C#
public bool Persistent { get; set; }

If not enabled, items will always spawn if generator conditions are met: for example, if you dig a hole, it will remove grass in the surface, but if you leave the area and come back, grass will spawn inside the hole. If enabled, and if the terrain has a VoxelStream supporting instances, this item will be saved in chunks where instances of it got modified (following the same events as voxel modifications), so if you leave and come back, instances of the item will remain in the same state as you left them. Only the transform of items is saved. Note: saving relies on identifying the item in save files with the same number given in the VoxelInstanceLibrary. Removing the item or changing its ID can lead saves to load the item incorrectly. See also [url]https://voxel-tools.readthedocs.io/en/latest/instancing/#persistence[/url]

Methods12

GetFloatingSdfOffsetAlongNormalfloat
# GetFloatingSdfOffsetAlongNormal
C#
public float GetFloatingSdfOffsetAlongNormal();
Returns float
GetFloatingSdfThresholdfloat
# GetFloatingSdfThreshold
C#
public float GetFloatingSdfThreshold();
Returns float
GetGeneratorVoxelInstanceGenerator
# GetGenerator
C#
public VoxelInstanceGenerator GetGenerator();
Returns VoxelInstanceGenerator
GetItemNamestring
# GetItemName
C#
public string GetItemName();
Returns string
GetLodIndexint
# GetLodIndex
C#
public int GetLodIndex();
Returns int
IsPersistentbool
# IsPersistent
C#
public bool IsPersistent();
Returns bool
SetFloatingSdfOffsetAlongNormalvoid
# SetFloatingSdfOffsetAlongNormal
C#
public void SetFloatingSdfOffsetAlongNormal(float sd);
Parameters
NameTypeDefault
sdfloat—
SetFloatingSdfThresholdvoid
# SetFloatingSdfThreshold
C#
public void SetFloatingSdfThreshold(float sd);
Parameters
NameTypeDefault
sdfloat—
SetGeneratorvoid
# SetGenerator
C#
public void SetGenerator(VoxelInstanceGenerator generator);
Parameters
NameTypeDefault
generatorVoxelInstanceGenerator—
SetItemNamevoid
# SetItemName
C#
public void SetItemName(string name);
Parameters
NameTypeDefault
namestring—
SetLodIndexvoid
# SetLodIndex
C#
public void SetLodIndex(int lod);
Parameters
NameTypeDefault
lodint—
SetPersistentvoid
# SetPersistent
C#
public void SetPersistent(bool persistent);
Parameters
NameTypeDefault
persistentbool—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.