|
This is a
utility to preview characters and character
animations.*
Source: CharacterViewer.zip
Often you want
an artist, who may or may not have a Virtools development license, to be
able to export a character with an animation and be able to preview how it
looks without having to rely on the Virtools programmer to integrate the
character into your game.
*Caveat: This utility is not
designed to load a character into an online web-based game, it is intended
to be used from the artists desktop (and will only work in that offline
way).
Usage
instructions:
1. Download
and extract the zip file. It contains these files:
2. Replace Character.nmo with your character file which also contains
an animation. (This setup doesn't allow you to check out multiple
character animation- just the one that is in the file).
3. Use the arrow keys to rotate around the character and to zoom
in and out.
Source Code Tutorial
Here's info on the setup of the source .cmo in case you want to modify
it for your needs.
The high level idea is to load our external
character, attach a Character Controller BB to it, and then aim the camera
at the character. Object Load BB is used to load the character and
get a reference to the character. Then we use Attach Script BB to attach a character controller
script. More on this in a bit. Finally we use Send Message
BB, to pass a reference to the character to the camera so that
the camera knows what to point at.

The trickiest aspect of this utility is that you want to attach a Character
Controller BB to a dynamically loaded character. For
whatever reason, Attach Script BB doesn't let you attach stock BBs to an
object. Instead it lets you attach an existing script to a new
object. So.... the script which contains the Character
Controller BB must first exist somewhere so that we can reference it as
the script to copy via Attach Script BB.
This is where the need for a dummy character comes in. By having a dummy character in the
file, we can create a script on it which will later be copied
onto the character that we load. The dummy character is hidden
and never seen.
Below is the script that is on the dummy character. The basic
component is the Character Controller BB which triggers the first
animation on the character. This first slot is called "Idle" in the
Character Controller BB, but you can call it anything you want and the
animation itself could be walking, dancing, or whatever other animation
that your artist wants to preview. The bulk of the work being done in this
script is to get a reference to the animation that is on the
character. By default, all of the animations in the Character
Controller will be --NULL-- so we need to get the collection of animations
off the character, then grab the first animation from the collection and
play that. The character will just have one animation in the
collection, but this was the first way that came to mind to grab a
reference to it.
---------------------------------------------------------------
|