This tutorial is about controlling the characters to perform various actions. SmartBody uses BML commands to set the character behaviors, such as posture, animation, gaze, and etc.
After you setup the character, he will be in T-pose, which is not very interesting.
So the first thing is to set a more natural posture for the character :
bml.execBML('ChrBrad', '<body posture="ChrBrad@Idle01"/>')
here, 'bml' is a SmartBody object for executing the BML command. The first parameter 'ChrBrad' indicates the name of the character for this BML command, and the second parameter is the BML command.
The format of a typical bml command is in the form of XML :
<commandName commandParameter="value"/>
For example, to set the character posture, the commandName is 'body' and the commandParameter is 'posture' with value to be 'ChrBrad@Idle01'. Depending on the commandName, a BML can have multiple commandParameters, though it is simply one parameter in this case. Note that the BML command needs to be bracketed correctly ( start with '<' and end with '/>' ).
Once we set the posture for Brad character, the idle animation loop will be applied on him.
We can also have Brad play the guitar by sending an animation command :
bml.execBML('ChrBrad', '<animation name="ChrBrad@Guitar01"/>')
This command will applied the Guitar animation on Brad. Instead of looping it like posture, the animation will only be played once.
Another behavior is head nod, which will have Brad move his head in different directions :
bml.execBML('ChrBrad', '<head type="NOD"/>')
Although here we only specify the head movement type as 'NOD', there are other parameters that can be set such as speed and magnitude of head movements. More details can be found in Section Head Movements.
The last behavior we will discuss about is gaze control. To setup a gaze, simply use the following command :
obj = scene.createPawn('obj1') obj.setPosition(SrVec(0.5,0.1,0)) bml.execBML('ChrBrad','<gaze target="obj1"/>')
Here the first two lines are not the real gaze command, but they should look familiar. They simply setup a pawn and set its position. This is because the gaze command require a gaze target, which is usually a pawn object.
Once the gaze is setup, the character will look at the pawn on the ground by rotating his head and spines :
If we try to move the pawn to a different location, the character will also adjust accordingly to track the new gaze target :
(To move a pawn, you can either apply pawn.setPosition command, or you can drag the pawn directly on the GUI window by selecting it with the mouse, pressing the 'w' key, then moving the manipulator handles.
More details about other BML commands can also be found in Section BML Behaviors.
Attachments:









