-
Notifications
You must be signed in to change notification settings - Fork 20
Custom Properties and Tags
Properties are available in Tetra3D as a means to specify properties on or identify Nodes.
These properties are exported from Blender in the GLTF export if the setting is enabled in the exporter settings (Include > Data: Custom Properties). Material, Mesh, and Object custom properties are exported into the Properties objects of Tetra3D's Material, Mesh, and INode-implementing objects, respectively.
Tetra3D Object properties, available in the Object Properties section
You can tweak visibility on a per-object basis by simply toggling the object's Visible checkbox.
Each Object has a Bounds field that you can use to change what kind of Bounds Node is instantiated along with the selected object when created (if any). Different bounds types also can have custom sizes - if a custom size isn't set or isn't available for the bounds type (like for Triangle Mesh bounds types), the bounds generally will "wrap" to fit the object. If the object is an empty (and so, has no dimensions to wrap), the bounds object won't be created.
Note that specifying the bounds type in this way simply creates an appropriate Bounds object and parents it to the object you have selected - actually checking for intersections and resolving collisions is still up to you to do in-game.
To copy bounds settings to multiple objects, simply right-click on the property (i.e. the bounds type, custom size boolean, or size parameters), and choose the option to Copy to Selected.
Without the Tetra3D Blender add-on, properties can be set up in the vanilla Custom Properties section of Blender and are exported in GLTF files without issue. However, the flow to create and edit custom properties in Blender is a bit awkward, and it's not possible currently to copy custom properties across multiple objects.
This being the case, the Tetra3D add-on steps in to help fill this role - it allows you to easily add, delete, copy, reorder, and tweak game properties, as can be seen in the screenshot above. Game properties are added to the object's Properties instance, just like vanilla custom properties.
There are currently a few different game property data types - Bool, Int, Float, String, Object, Color, 3D Vector, and Filepath. The Object property type extends a normal String type, and simply allows you to easily point to an object in a scene. If no scene is specified in the scene dropdown menu, then the object dropdown menu can select from all objects in all available scenes.
The Object game property type, here shown pointing to the "Teleport B" object in the Scene named "Scene"
On export, the reference gets converted to a string, composed as follows: SCENE_NAME:OBJECT_NAME
. In this string, the first portion, SCENE_NAME
, is the name of the scene referenced, while OBJECT_NAME
is the name of the object referenced. The colon delineates these two names (and so, you would use strings.Split()
to get the two individual portions). If no scene is specified in Blender, then SCENE_NAME would be blank.
When a property is set to a 3D Vector, you'll be able to set the X, Y, and Z positions manually, or make use of two buttons to set the vector to the object's world position, or the current position of the 3D cursor. Note, of course, that the position of the Vector in Blender is automatically converted to Tetra3D's world-space when the property is exported.
The Filepath property type is also just a string, though if you select a sound file, you'll be able to play it back to demo it by pressing the play button next to the file browse button. (Not every sound file will demo correctly, it seems.)
You can visualize object properties in a 3D view by using the "Draw T3D Properties" view spinner in the 3D view's header.