Freigeben über


Mini Cube - Ready for Developers (Can you finish it?)

I love 3D, so I'm always trying to incorporate it in my projects. And what better opportunity to work with 3D than a blog post! This week I want to share this Mini Cube project, which is a (2x2) simplified version of that famous game that gave me so many headaches in the past. This is a perfect candidate for a 3D sample, since you have to visualize the cube in three dimensions in order to play it properly.

This project is not finished yet, I've prepared the 3D objects and some interaction, but the cube doesn't "work", which means you can't rotate the blocks. But that's the point of this post... invite you to finish it ;-) So, let me give you an idea of what I have done so far and see if someone wants to take it to the next level:

Download the project here (Maya and Blend projects included).

image

Creating the 3D Objects

The workflow I used was Maya 6.0 > Export to Obj > Import Obj in Blend. In Maya I was able to create the geometry, separate materials, and adjust the pivot points for each block. For the geometry, I also created a few extra objects that will receive mouse events in Blend. If you click on one corner, you will notice that a Message Box shows the name of that corner (red1, red2, etc...) Please, see the following image to see where they are located. You can find the original Maya project in the project ZIP file (/miniCube/Maya_files).

 image

Importing the Obj File in Blend

To import a Obj file you just need to drag the files to your WPF Project in Blend. Just remember that you have to drag the .obj and the .mtl files. The latter contains all the materials that you defined in Maya. Double click the file cube.obj to insert into the Artboard. Then use Camera Orbit to rotate the 3D space.

image

What else is Ready in Blend?

Ok, that's the general idea. Now if you open the Blend project you will see that I've prepared a few more steps:

  • I've created new groups in Blend for the blocks (b1, b2, b3, etc...)
  • The project has several Storyboards for each block. Those Storyboards are rotating each block in X, Y and Z, in both directions.
  • The code behind (Window1.xaml.cs) has basic interaction to rotate the cube.
  • If you click on a corner, you can see a Message Box that shows you which corner got the event (look for the method OnMouseUp in Window.xaml.cs).

What's Next?

Well, since you have the Holidays, you can use that time off to finish this project! The next steps are not easy, but interesting. You can use the Storyboards that are already there, or you can rotate the blocks using just code. The idea now is to make the cube work, so you can come back from the Holidays and spend your time playing the game at work! Just kidding...

I will publish the final project in January, but I would be glad to publish any solution that you might send us!

 

Enjoy, and Happy Holidays!
-Celso

Comments

  • Anonymous
    December 18, 2007
    PingBack from http://geeklectures.info/2007/12/18/mini-cube-ready-for-developers-can-you-finish-it/

  • Anonymous
    December 18, 2007
    I love 3D, so I'm always trying to incorporate it in my projects. And what better opportunity to work

  • Anonymous
    December 18, 2007
    I love 3D, so I'm always trying to incorporate it in my projects. And what better opportunity to

  • Anonymous
    December 19, 2007
    I have never used Maya, but doesn't "Maya 6.0 > Export to Obj > Import Obj in Blend" seem an oxymoron?

  • Anonymous
    December 19, 2007
    Interesting! Can you tell me how many 3D format file can import to Blend?

  • Anonymous
    December 26, 2007
    cool idea! but the link to download is not working right now :| (Internet Explorer cannot display the webpage)

  • Anonymous
    December 27, 2007
    Can Blend v1.0 import ".objs"? Or is this new functionality in the v2.0 beta???? I previously thought that thier was not any support for .obj's?

  • Anonymous
    January 09, 2008
    It seems that a few people are having questions about using 3D in Blend, so here it goes a quick overview: 3D files you can import in Blend (available in Blend 1.0 and 2.0 preview): .OBJ (Geometry) .MTL (Material Library that works together with .OBJ files) .XAML (native WPF 3D objects) You can also crete 3D planes from bitmaps in Blend:

  1. Import a bitmap to the Artboard.
  2. Select the bitmap.
  3. From the menu, select Tools > Make Image 3D But if you don't work with OBJ format, you can use other pacakges to convert to OBJ or XAML: http://www.erain.com/products/ZAM3D/DefaultPDC.asp http://www.highend3d.com/maya/downloads/tools/3d_converters/3782.html
  • Anonymous
    January 16, 2008
    I periodically run into queries for tools for modelling 3D content for use with XAML. Here are some notable

  • Anonymous
    June 07, 2008
    I love 3D, so I'm always trying to incorporate it in my projects. And what better opportunity to work with 3D than a blog post! This week I want to share this Mini Cube project, which is a (2x2) simplified version of that famous game that gave me so man

  • Anonymous
    November 14, 2008
    I've developed a version of this for Microsoft Surface: http://www.youtube.com/watch?v=kSJ4BFk3afQ