Sunday, December 15, 2013

Importing Mesh and Animation from 3D Studio Max to Unity3D

In past some post I tried to show how we can perform 2D animation and collision detection.

In this post I am will show I we can import 3D mesh with animation created from 3D studio max to Unity3D and animate the same.

So lets start, I created a sample mesh with animation with 3D Studio max.

We need to export it using FBX file format, which we can easily import in Unity3D.

To import it, you can drop the created FXB format file to Asset folder in Unity3D. Once you import it click imported mesh to display its property in Inspector window. In Inspector window click on Rig tab and set animation type to Legacy.

This is required else animation will not play and you will get error "Animation needs to be marked as Legacy"

Now we can use this mesh and perform animation, you can also change its property like play automatically or loop animation.

Now lets add a script, which make model jump when pressing some button.

And here is script.
using UnityEngine;
using System.Collections;

public class JumpAnimation : MonoBehaviour {

 // Update is called once per frame
 void Update () {
  if(  Input.anyKeyDown ) {

So now its ready,if you press any button now, it should jump. Here is video how it looks.


Saturday, December 7, 2013

SteelSeries controller Controller Un-Boxing

I also received SteelSeries controller along with MogaPro gontroller, from BlackBerry Gamepad offer. You can find MogaPro controller's unboxing here.

Following are few unboxing pics from SteelSeries controller.

Box in which it came.

Back side of box.

Front side of controller.

Came with a carry pouch and micro USB cable..

Looks quite small in my hand.

Close up of front side.

Only two button at backside.

Micro USB port.

MogaPro gamepad Un-Boxing

So I received my MogaPro gamepad tanks to BlackBerry GamePad promotion event. Here is un-boxing pictures for the same.

Box in which it came.

It came with micro USB cable to charge controller and a nice stand to place tablets.

The back side of controller.

Micro USB port to charge controller.

Front side.

Power on button and holder for Phones.

Sunday, December 1, 2013

BlackBerry gamepad offer

As you might know BB10 support gamepad, that mean you can connect gamepad to Device via Bluetooth and play games using it. And to promote gamepad enabled game, Blackberry also announced an offer. You can get more details about offer here.

For the same offer I got mine GamePad recently. I also enabled my CrazyFlight game to support GamePad. Here is demo.

Exposing C++ ENUM to QML

I was working on update of one of my game and I while re-factoring I was required to expose C++ Enum to QML code.

Following is how header looks like with definition of Enum GamePadButton. I am registering Enum with Qt's Metaobject system using Q_ENUMS macro.
class GamePadObserver: public QObject {

 enum GamePadButton{

 GamePadObserver(QObject* parent = 0);
 virtual ~GamePadObserver();
Now to be able to see this Enum to QML code we need to register GamePadObserver class to Qt Metaobject system.If you want to be able to create instance of class then you can use qmlRegisterType() macro.

In my case I dont want to create instace of GamePadObserver in QML, I just want to expose it enum to QML and for that purpose we can use qmlRegisterUncreatableType macro. Its useful for exposing enum and attached property. Following how we can use this macro.

int main(int argc, char **argv)
 qmlRegisterUncreatableType("GamePadObserver", 1, 0,"GamePadObserver", "");
Now we can use Enum from QML, following how we can do that.
import GamePadObserver 1.0

Rectangle {

        target: GamePad
        onButtonPressed: {
            if( button == GamePadObserver.X_BUTTON
            || button == GamePadObserver.Y_BUTTON 
            || button == GamePadObserver.A_BUTTON 
            || button == GamePadObserver.B_BUTTON ) {