Applying Material in Away3D

I wanted to know Away3D basics first, before getting my hands dirty with Broomstick. So, currently I'm using version 3.6.

I looked at the Ferrari sample, and i replicated it - all seemed fine.
But when I created my own model - I wasn't able to apply material in Away3D.

Funny thing - a lot of people seem to have the same issue and no results have been posted yet. So after Google(Nasdaq GOOG.. lol.. that outta belittle you) finished playing cruel tricks on me, I was finally able to figure out the issue on my own.

Step 1: Modelling
Create the 3D Model and Unwrap UV
Go to Material Editor - Select a material and set a name for it - This is very important!
Apply this material and export it as a 3DS Model

Note: I'm using some old 3DS Max 2008 trial version that I got in a DVD along with some boring useless book, so a lot of things may be different or changed. And yeah, the new Blender is apparently awesome - gotta try it.

Step 2:
In Away3D, get the mesh ready and do the following

// Load the model, use load or parse - me use parse
// Gift me a server or shut up
myMesh =  Max3DS.parse( /* Embedded Resource */);

// Apply the material
// Note: The name "SKIN" is same as the one we set before
myMesh .materialLibrary.getMaterial("SKIN").material = Cast.material(/* Embedded Texture*/);

Just an FYI how I found this -
I opened the binary 3ds file in notepad++ and found only few things that were human readable - model name, material name and texture filename. So, yeah, it was a brute force attack.

NTFS: Prefer NOT to apply "texture or image" before export - will give resource not found run time error

True Engineering

I came across this hack-a-day post. It's about how Rice University students rigged Wii Boards to help kids with disability learn to walk.

From their website:

"By cleverly linking five Wii Balance Boards, a team of Rice University undergraduates has combined the appeal of a video game with the utility of a computerized motion-tracking system that can enhance the progress of patients at Shriners Hospital for Children-Houston.

The Rice engineering students created the new device using components of the popular Nintendo game system to create a balance training system. What the kids may see as a fun video game is really a sophisticated way to help them advance their skills. The Wii Balance Boards lined up between handrails will encourage patients age 6 to 18 to practice their balance skills in an electronic gaming environment. The active handrails, which provide feedback on how heavily patients depend on their arms, are a unique feature.

Many of the children targeted for this project have cerebral palsy, spina bifida or amputations. Using the relatively inexpensive game console components improves the potential of this system to become a cost-effective addition to physical therapy departments in the future."

Check out  this video on Youtube:

How sweet is this? Come to think of it.. We.. thats right.. You too (95% probability  - 80% that XNA, Game or Actionscript got you here and 15% that you are a known friend ) as engineering grads forgot all about making lives better and sadly, everything after college life is about "Money"

Pinball Box2D Prototype

This has been due for quite a while now - another reason I should never consider "project management."

But in my defense:
We won the World-Cup. So spent a lot of days being "high"
IPL going on (ah c'mon.. cheerleaders)
Guess who saw 3 seasons of Clone Wars? Muhaha \m/

Ok so I wanted to learn how to use a "Physics Engine" in a game. I narrowed down to Box2D.
I wanted to make something new, so I thought how about a Pinball game! Well.. apparently people have already tried that.. so.. boo hoo.

I actually ran into some trouble, expected - considering this was the first time I used it. I didn't how to rig up the "Flipper" system. Then I came across this post. So that was the moment of "Boo hoo" i told above, people already "Been there, coded that"

The Game: (Requires Flash Player.. duh)
[Its 1 MB, wait till it loads]


Use LEFT and RIGHT Arrow Keys
P to Pause
SPACE or CLICK in the first screen

Known Bugs:
Flipper collision fails sometimes, probably due to drop in frame rates (Box2D requires constant time step)

Things to keep in mind:
When using b2RevoluteJointDef, do NOT set mass to zero and enable limit and motor.
Velocity and Position Iterations have little effect, they didn't seem to fix the flipper issue.

Note: It's doesn't work with with Flash Player 11