Avatar Controller

Tutorial:Advanced Concepts - Avatar Controller
Time to complete: 10 minutes approximately
Summary: Want to run around your Environment? This tutorial will show you how.
Aim: To learn how to use the Avatar Controller so you can move around in world.
Required application: VastPark Creator

I'm going to show you how to use the Avatar Controller and apply it to an Avatar so you can move around your environments.

What you need:

  • Avatar Controller
  • Avatar with bones
  • Camera
  • A ground for the Avatar to walk on.

Setting Up the Scene

To save some time I've created a park with a Camera, Light, Skybox and a model. If you don't have your own park set up already you can follow along by downloading the park I created here.
The first thing we need to do is download both the Avatar Controller and an Avatar with bones. I know that the Chloe avatar is ready to go. So do a search for Chloe you will get two results, for now just use AV-Chloe by double clicking on it. Now do a search for the avatar controller, the plugin is one word AvatarController.Double click on it to use it.

Make Chloe's position 0,0,0

Make sure the Great Hall has physics enabled so your avatar can walk on it. You can enable this by selecting your "ground" in the project list, go into it's properties and check the Enabled box in the behaviour panel.

You will also need a box to make the ground for our avatar to walk on. Insert a box into the scene and make its size 100,0.1,100
Make it's position 0,0,0. Enable the physics and then turn the opacity down to zero. Now you have a ground for walking!

The scene is now setup for us to go into IMML. To view the IMML you need to click the IMML tab which sits in the bottom left of the scene. This will open the IMML editor which is similar to HTML editor's like Dreamweaver.
A lot of the IMML is created when we add elements in the design view, we just need to make a few changes in order for the Avatar Controller to work with our Avatar.

We first want to add a couple of parameters to the Avatar Controller so it knows what it is controlling. When you've located the AvatarController in the IMML it should look like this...

< Plugin Name="AvatarController" Enabled="False" Source=""/ >

What we want to do is add in a closing tag and between the opening and closing tags add in parameters that look like this...

< Plugin Name="AvatarController" Enabled="True" Source="" >
    <Parameter Key="UseModelProperties" Value="False" />
    <Parameter Key="Radius" Value="0.4" />
    <Parameter Key="ForwardsKey" Value="Up" />
    <Parameter Key="BackwardsKey" Value="Down" />
    <Parameter Key="LeftKey" Value="Left" />
    <Parameter Key="RightKey" Value="Right" />
    <Parameter Key="RunKey" Value="RightShift" />
    <Parameter Key="AltForwardsKey" Value="W" />
    <Parameter Key="AltBackwardsKey" Value="S" />
    <Parameter Key="AltLeftKey" Value="A" />
    <Parameter Key="AltRightKey" Value="D" />
    <Parameter Key="AltRunKey" Value="LeftShift" />
    <Element Name="AV-Chloe" />
    <Parameter Key="Avatar" Value="AV-Chloe" />
  </Plugin>

Now our avatar is ready to move around!

Our avatar is now set up ready to control but we need the Camera to chase our avatar. We can make it do this by adding ChaseTarget="AV-Chloe" inside the camera's IMML. The camera also needs to have "Enabled" set to true in it's IMML so that Chase will work.

That's it for the IMML so jump back into Design view. The last thing we need to do before testing is set the Camera to be the default Camera for the park. This can be done by selecting your park in the project list and viewing it's properties. In the appearance panel click on the Camera drop down and select your Camera from the list.

We're done! Go into interactive preview and you should now be able to run around with the camera chasing your avatar. You can get a copy of the final park by clicking here
If you have any problems be sure to leave a post in our forums.

character.jpg (210.3 kB) Michael Louca, 03/03/2010 10:12 am

KnightsHall.park (2.7 kB) Michael Louca, 03/03/2010 10:12 am

KnightsHall-stripped1.park (1.3 kB) Michael Louca, 03/03/2010 10:12 am