3Dengine, need help with controls

heya all,

edit: http://ezakirth.free.fr/test/ works now :smiley:

I started this 3D engine from the ground up mostly just to understand how they’re done, but now I want to see how far I can go.
The goal is a top view 3D zelda like game that i would eventually port to iphone (hence the controls)

I’m there atm: http://ezakirth.free.fr/test/ with some really messed up toon rotation :stuck_out_tongue:
It’s not really optimized and no physics are implemented yet, only semi cute thing here are the non-character textures with fake lightning ^^

Anyways, I usually come up with a solution to problems on my own, but i’m getting pretty angry at myself right now…

I just can’t find a way to implement the character orientation based on a joystick direction.

I get the joystick angle with

ang = Math.atan2(pad.ctrl._y, pad.ctrl._x);

I then loop through all the vertices in my toon’s array and attempt to rotate them accordingly

I tried implementing the two rotation around Y axis formulas that i know and neither are working for me.
http://ezakirth.free.fr/test/test.html (click on formula to change type)

the first one i feel i could do something with, but I can’t find a way to implement it. My toon is a cube atm, therefore all the points are at the same distance from the center, which messes it all up :frowning:

for...
 {
        toon[j].x = cos(angle)*dist + tcenterx;
        toon[j].y = sin(angle)*dist + tcentery;    
 }

when i try to “off” the cube’s center, i get this:http://ezakirth.free.fr/test/test2.html
My model is now flat :frowning:

I don’t think i can use the second formula here as it works by increments, not a set angle, and it would feel like a scary amount of work to make it…mmm…work.

Anyone have any idea on what i should do ?

Best regards,