Die game

Started by Familyfriend, September 27, 2011, 03:46:16 PM

Previous topic - Next topic

Familyfriend

Hi,
I'm a new 3D graphic developer. I stater looking at it only few weeks ago, i decided to try to implement a simple die game wich you can roll a 3D die shaking the phone.

I downloaded jCPT-AE and a physic engine called Jinngine.
I managed to implmenet walls and the cube but my problems start when i have to translate the physic cube ( the die ) state to the graphic wolrd.

I made it going around with the translate method but i can't figure out how to set the rotation matrix to the 3D object.

i've been tring in a few ways but i can't work around it:

  • setRotation(Matrix m ):  it didn't work cause of some strange rendering of the box, after the rotation it came out streched and only half visible

  • align( . . ): i read somthing in the forum about this method bu to be honest i can't get what to pass to the method, thre is one that wants an Object3D to align to and an other one that follow the camera.

  • i derived the X Y Z euler angle from the matrix and i applied them with the rotateX/Y/Z() method, that almost work except for a realy bad flickering of the die



can anyone help me or at least share his knowledge on what i'm tring to do?
it shouldn't be the most task difficult ever, i mean, i do have a 4x4 matrix rappresenting the rotation of the physic object so i guess i just missing something in between the translation.

thx in advance

firstdeathmaker

QuotesetRotation(Matrix m ):  it didn't work cause of some strange rendering of the box, after the rotation it came out streched and only half visible

Maybe the order of the physics matrice is another one than in jpct? Remember, jpct works with a coordinate system that is different from what is usual in mathematics: http://www.jpct.net/wiki/index.php/Coordinate_system. That did confuse me also.