Graph EditorThis is a featured page


There are a number of ways to add logic to scenes that you create in Blade3D. The visual programming system is perhaps one of the quickest and most efficient ways to accomplish small programming tasks.

Although this system is not as flexible as using script, when used correctly it can be a huge timesaver. Also the visual programming system is very light weight and efficient at run-time so wherever possible you should try and utilize it in preference to script.

The simplest possible logic diagram is to control a single property on an object. As an example let's say that we want a cube to change its size over time.

One way we can do this is to create a cube in our scene and then create a simple logic diagram to drive the "Length" property on the cube.

So, let's start with an empty scene and insert a cube using the toolbar.

Graph Editor - Blade3D
A simple cube added to the scene

Now right click the "Graphs" folder and choose "Create->Logic Diagram" from the context menu.



Graph Editor - Blade3D
Creating the logic diagram

Graph Editor - Blade3D
After creating the logic diagram a graph worksheet will appear in the scene.

Since we want to control the length property on the cube we will need to add the cube to the graph worksheet. To do this you should drag and drop the cube object from the scene on to the graph.



Adding the cube to the logic diagram

After adding the cube to the logic diagram, the worksheet in the graph editor should look something like this:

Graph Editor - Blade3D

Now we want to control the Length property of the cube so drag the "Cube" node you just added around on the worksheet until you can see the property called "Length". Your logic diagram should now look something like this.

Graph Editor - Blade3D
The logic diagram after positioning the cube obect to show the Length property

Tip: The length property is toward the end of the cube properties.
Tip: You can use the scroll wheel on the mouse to zoom in and out of the design surface.
Tip: You can pan around the entire graph by dragging the blue worksheet surface in the graph editor.
Tip: You can resize the worksheet by dragging the sides or corner of the border.

NOTE: When the logic diagram system was first designed objects in Blade3D did not have very many properties. These days some objects can have more than thirty properties that may be controlled. In the future we plan on improving the layout so that properties are properly categorized.

Now that you have added the cube to the logic diagram and the Length property is in view it's time to add an operator that will be used to drive the Length property. For this example we will use a simple oscillator. To insert the oscillator right-click the logic diagram worksheet and selecte "Create->Sin Wave"

Graph Editor - Blade3D
Adding the Sin Wave oscillator to the logic diagram
Graph Editor - Blade3D
The logic diagram after adding the Sin Wave oscillator.
Now the only thing left is to connect the output of the oscillator to the Length property and configure the oscillation frequency. To connect the output of the oscillator to the Length property on the Cube simply drag from the white output pin next to the "Result" property on the operator and drag it to the white input pin next to the "Length" property on the Cube. After doing this you should see something like the following.

Graph Editor - Blade3D
The logic diagram after connecting the output Result to the Length

Finally we need to configure the frequency of the oscillator. To do this double-click the operator on the logic diagram worksheet to open the property sheet. Set the Frequency to 0.3 (Hz) and set the DC Bias to 1. Click on the cube node in Object Browser to hide the graph editor. Congratulations, if all has gone well your cube should be oscillating!
Here is a video showing the entire process from start to finish.


Now let's consider a more complex example in which we build a simple character controller that uses the Xbox 360 GamePad to control the orientation of a model.


Graph Editor - Blade3D


digini
digini
Latest page update: made by digini , May 31 2007, 4:57 PM EDT (about this update About This Update digini Edited by digini


view changes

- complete history)
Keyword tags: graph logic diagram
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.