Sunil's Blog

Icon

Starscream, Boba Fett and Jabba the Hut…er…Jasmine the Cat…FlarToolkit AND 3D Animated Models with Keyboard Control

Here’s a link to the live demo to try yourself:

Boba Demo

Direct your iphone here (don’t waste paper, if you can help it!!):

Boba – http://www.suniljohn.com/labs/boba/markers/boba.jpg

Starscream – http://www.suniljohn.com/labs/boba/markers/starscream.jpg

Print the markers here:

Boba – http://www.suniljohn.com/labs/boba/markers/boba.pdf

Starscream – http://www.suniljohn.com/labs/boba/markers/starscream.pdf

There are keyboard controls for both models. ASDW to move Starscream and directional arrows to move Boba Fett. Each character also has jump, taunt and attack controls. There are about 14 other animations I haven’t had time to program.

I re-factored the earlier multimarker flar prototype to use the FLARManager 0.3 from Eric Socolofsky at transmote.com. I was able to trace out the string names of the individual 3D channels of the MD2 models I’ve been using. I can now play the individual animations I want to play instead of looping through them all.

This snippet might help those that are trying to figure out the string names of the 3d channels of their MD2 Quake 2 models:

//_channels = new Array();
  1. //   _channels = animatedBoba.getAnimationChannels();
  2. //
  3. //   trace("channel count", _channels.length);
  4. //
  5. //   for each(var channel:AbstractChannel3D in _channels) {
  6. //    _numFrames = Math.max(_numFrames, channel.keyFrames.length);
  7. //    channel.updateToFrame(_currentFrame);
  8. //    trace("channel.name", channel.name);
  9. //   }

I also implemented Saqoosha’s hole effect using Papervision3d, in the form of trap doors, with some slight modification to what cube faces are visible. I think this has to do flipped coordinate space, when comparing a standard PV3d scene and to the flarnode. Here’s the mod:

Instead of :

var hole:Cube = this.scene.addChild(new Cube(new MaterialsList({all: cmats, bottom: cmatb}), 300, 300, 300, 1, 1, 1, Cube.ALL, Cube.TOP)) as Cube;
  1. this._green = this.scene.addChild(new Cube(new MaterialsList({all: new ColorMaterial(0×00ff00)}), 300, 300, 300, 1, 1, 1, 0, Cube.TOP)) as Cube;
  2.  
  3. Changed to:
  4.  
  5. var __hole : Cube = new Cube(new MaterialsList({all: __cubeSideTexture, bottom: __cubeBottomTexture}), 80, 80, 80, 1, 1, 1, Cube.ALL, Cube.FRONT);
  6. var __green : Cube = new Cube(new MaterialsList({all: new ColorMaterial(0×00ff00)}), 80, 80, 80, 1, 1, 1, 0, Cube.FRONT);

I went through at least 10 different asymmetrical patterns for the Starscream flar marker. Most of the time the camera would keep losing the pattern or confusing it with the Boba Fett pattern. Bad lighting and problematic marker patterns were the biggest issues.

I don’t have to use keycodes very often, but when I do it’s always a pain trying to remember what uint corresponds with what key. Here’s a snippet I picked up for using as3 to generate keycodes:

http://evolve.reintroducing.com/2008/11/21/tips-n-tricks/flash-key-codes/

The end result isn’t quite this:

starwarschess

….but each time I revisit this prototype it’s seems to be getting closer….

In the future I want to implement mac3d’s adaptive filter, to help eliminate problems with marker detection caused by poor lighting conditions.

Also what fun would spawning 3d characters  in AR be without laser canons and collision detection!?!

jasmine_jabba

Category: AS3, FlarToolkit, Papervision3D

Tagged: , , , , , , , ,

9 Responses

  1. makc says:

    I always thought those chess were actually clay animation, they do not really look like cgi.

  2. Sunil says:

    You’re absolutely right…I wonder if they replaced the claymation in the enhanced re-releases a couple years back.

  3. Javier patiño says:

    nice work… I try to use flarmanager with DAE.as but is imposible.. only works with MD2 or Collada.as.. and for move the model I use in flash iDE DAEMC.as for load an animated but in flashmanager dont work..can you help me with that

  4. s heng says:

    can you drop me an email, thanks.

  5. John Warren says:

    Hey there! Awesome work! I have been meaning to get into FLART and papervision for a long time now and just recently have been toying around with it. I am at the point now where I can get .md2 models to work with it and all but in order to get to the next level I need to find out how to control the animations that are embedded as well as move the model with keyboard events. If you could shoot me off an e-mail to possibly help me out or even some source code so I can take a peak it would be greatly appreciated. Again awesome job man!

  6. Aloysio Chagas says:

    Hello, Sunil. Nice work! I’m trying to do what you did but I can’t.

    Already I can load multiple markers and their md2s but I got some delay and and the objects are very slow, appearing and desappearing all the time.

    What are you did and if you can, help me!

    Thanks! :)

  7. Leanne says:

    Hi Sunil, this is great. I have some questions about getting MD2 to work in FLAR- namely, how?! I have been working on this for a school project for two days and could really use the help if you could drop me an e-mail. I was able to get MD2 to load in a papervision file, but not the SimpleCube for some reason. Hope you can help. Thank you!

  8. Ben says:

    Hi,

    I’m just starting to get into flartoolkit. I was wondering if you could send me your source code so that I could learn from it. Thanks!!!

  9. Patrick says:

    I’m curious if you could go into more detail on your 3d-Channel naming code (I’m facing a similar problem)

Leave a Reply