Some suggestions about Building Blocks in Virtools

Don't use BBs in scripts to do things that you can do manually instead.

Many BBs simply set parameters on objects that you can otherwise do in the setup windows. Only use the BB if those parameters are being changed dynamically over the course of the running scene.

For example, if you want your camera to have a wide angle field of view, you can set the parameter manually in the camera's setup window.
Yes there is a Set FOV BB, and it is handy to use if you are doing an interactive zoom or somehow changing the FOV on the fly - but if the camera is a fixed FOV, you don't need to use it.

Another example is the common mistake of using the Declare Obstacle BB for collision detection. Reading the manual, you'll see how to manually set the attributes on an object to declare it as an fixed or moving obstacle. It's most likely you will declare obstacles during the authoring stage rather than dynamically. Using the Declare Obstacle BB in a loop is a useless action.

Ask yourself "Can I do this manually in the setups or do I really need to use this BB?"


Some BBs can be useful in (temporary) authoring scripts rather than for the final run time.

A good example is the Invert Winding BB (Mesh Modifications/Local Deformation).
Let's say you exported an object from Maya and accidently left the normals reversed. You could go back to fix it in Maya, or you could run this BB on the mesh to reverse the order of the face definitions. You would only run this once and then delete the BB - otherwise every other time you run the scene the object's normals will be reversed!

Another example might be Set Material BB (Material-Textures/Basic). If you want an object to share a material that is elsewhere in the scene, you'll need to use this BB since the Mesh setup window does not allow manually changing Materials (although note that the Material setup does allow you to manually select assigned Textures.)

This can get bigger in scale. What if you accidently wind up with a scene that has 100+ textures that are way too big in resolution? You could use the setup window and rescale them manually one by one - OR you could put them all in a group with one click, then make a script using a Group Iterator BB and a Set Texture Size BB and you are all set! (Once done, you don't need the script any more, but you could package it into a "Behavior Graph" and save it for when you make that same mistake again!)

Think of using scripts to help YOU in the authoring process, rather than just how they serve the end result. This way of thinking can lead to fun solutions, such as having a script automatically build a labyrinth through random functions - then every time you run the script it will be a new maze for you to find your way out of!