x_screen2world, workiiiiiiiiiiiiing!!! :D

Previous topic - Next topic

mentalthink

Ok, for me a really usefull command, now works in the last update!!!, the log file, only tells this works on iPhone, but I test in Android and Palm Pre, and works very fine!!!.

Thanks, Gernnot for hear our prayers!!!,   :nw: :nw: :-* :-* :enc: :enc:

Crivens

How exactly does it work? Can it, for example, place a 3D object at a set position on the screen? So for example I could have a score on the screen (that never moves) using a 3D "font" (using individual 3D objects) for example?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Kitty Hello

yes, so.
Search the forums for the bug report. It has a proper example.

[edit]
can someone copy that example to the X_WORLD2SCREEN manual (also German?), please? :D

mentalthink

Well, I put this code, because in Android and Palm Pre, you need a little modification, because the effect differs a little of the pc.
Code (glbasic) Select

GETSCREENSIZE sizex,sizey

LOCAL a, sx,sy,sz, wx, wy, wz

X_LOADOBJ "Media/Box001.ddd",1

WHILE TRUE
INC a,3

X_MAKE3D 1,10000,65

X_CAMERA 0,0,10, 0,0,0
X_SCREEN2WORLD (sizex-sizex/2)+(2050*COS(a)),sizey,0, asx, asy, sz#

X_MOVEMENT asx,asy,0
X_DRAWOBJ 1,0

X_MAKE2D
PRINT "*",sizex/2+(205*COS(a)),sizey/2
SHOWSCREEN
WEND



Well you can see, extrange things, like multiplications and divisions, well how my maths ara very rubished, I think the explanation is this:

The measures in the 3D world, are 100 pixels are equal than one unit in 3D world, ok?¿.

Well for this you can see in the world2screen command it´s multiplied by 10 becuase the pos in Z, of the camera it´s 10 units, I dont´stay sure about this but for me works, very well.

I attach the complete code, if you test in PC, Android or Palm Pre, runs exactly equal, on iPhone I dont´t test yet, but perhaps, you don´t need to make this multiplication.

PS: Not it´s fully tested and perhaps the thinking about this, not it´s propper, if anyone can tell more about this, please comment here!!!...

Kinds Regards,
Iván J.



[attachment deleted by admin]