3d model

Previous topic - Next topic

Cliff3D

Quote from: mars_chaos89 on 2010-Oct-06
as im looking at x_world2screen..i saw another command which is x_screen2world...im a bit confused here...what is the different between this two command?and which 1 should i use?

x_world2screen converts "x" 3D co-ordinates your program provides the function to 2D co-ordinates on the screen, plus "behind screen" or "in front of screen" data.

x_screen2worldrather cleverly does exactly the opposite, converting 2D co-ordinates (plus "in front of" or "behind" screen) to 3D co-ordinates.

Note that, while the former should be very predictably accurate, owing to the way 3D maps to 2D and back again IMHO x_screen2world is subject either to further explanation or to being able to produce more than one result i.e. the answer it provides may not be the one you expect/need, despite being correct - because more than one 3D co-ordinate can be present (IS ALWAYS PRESENT!) at any given 2D screen co-ordinate. What makes one answer more significant - and worth reporting as "THE" answer - is unclear from the manual IMHO.

mars_chaos89

sory guys for bothering you all again....

i just want to ask for your opinion and suggestion....which 1 is better and easier?

option a:

-the user click on the any part of the model and the 'x' mark appear where the user click the button

option b:

-the user push a button and the 'x' mark appear anywhere and then the user can pick the 'x' mark to where he want it on the plane...


any suggestion or opinion?


Cliff3D

Quote from: mars_chaos89 on 2010-Oct-06
sory guys for bothering you all again....

i just want to ask for your opinion and suggestion....which 1 is better and easier?

option a:

-the user click on the any part of the model and the 'x' mark appear where the user click the button

option b:

-the user push a button and the 'x' mark appear anywhere and then the user can pick the 'x' mark to where he want it on the plane...


any suggestion or opinion?

Option a is easier for the user and therefore "better" from that perspective. Depending on how (and how well) the X_SCREEN2WORLD actually works, this could be far harder to code.

Option b is easier to code (so may be considered "better for the coder" from a certain perspective) but requires more effort from the user.



From an overall perspective I would generally say that, if you can program it, the superior result is one that is easier/better for the end user (which would be Option a - if you can program it).

mars_chaos89

how can i know that the x_screen2world functioning properly?


mars_chaos89

i have test the command and for the time being i just make the 'x' model to follow the pointer at the start of the program and it follow it...

i have an inquiry to ask....

i use x_movement after i use x_screen2world to make the model follow the pointer...but when i use the x_movement command my x_scaling did not work..it does not shrink the model...why is it happening?

i ahve try several ways to solve it but it still the same...

first :

x_movement mx,my,mz
x_scaling 0.2,0.2,0.2
x_rotation 90, 0,1,0

2nd :

x_scaling 0.2,0.2,0.2
x_movement mx,my,mz
x_rotation 90, 0,1,0

Cliff3D

I don't know, I use your second example (scaling first, then movement, then rotating) and my models certainly do scale.

mars_chaos89

ok my bad.....it is being scale...sorry2 for bothering you.....

matchy

This is from the samples folder; mouse pointer to ray.  :rtfm:
Code (glbasic) Select

MOUSESTATE mx,my,b1,b2
X_SCREEN2WORLD mx,my,  0 , x, y, z
X_SCREEN2WORLD mx,my, -1, x2,y2,z2
ray=X_COLLISIONRAY(OBJ_BLOCK,0, x,y,z, x2-x, y2-y, z2-z) // smaller=closer

Cliff3D

Quote from: matchy on 2010-Oct-07
This is from the samples folder; mouse pointer to ray.  :rtfm:
Code (glbasic) Select

MOUSESTATE mx,my,b1,b2
X_SCREEN2WORLD mx,my,  0 , x, y, z
X_SCREEN2WORLD mx,my, -1, x2,y2,z2
ray=X_COLLISIONRAY(OBJ_BLOCK,0, x,y,z, x2-x, y2-y, z2-z) // smaller=closer


That looks incredibly useful and applicable.

mars_chaos89

X_SCREEN2WORLD x,y,0,   wx,wy,wz

IF mbl=TRUE
   X_MOVEMENT wx,wy,wz
ENDIF

when i use if my application become like this :

the marking model is appear only when the left mouse button is hold and it disappear when i released the left button....
it does follow the mouse when it appear....
how can i do to make the model still there when i released the button?