GLBasic forum

Main forum => GLBasic - en => Topic started by: mentalthink on 2011-Apr-29

Title: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: mentalthink on 2011-Apr-29
HI, well this is the question, How do this?¿... , I look the code of Gernnot, "Entity 3d" , but I don´t undertand very well how put the same function on my code, because have types and some code I don´t know very well how works.

Another question, is when we can add Specular or Normal Maps, this can be implemented on a near future. (on mobiles devices, normal Maps works very fine on Desktop Computers)

And another, and last, sorry( today I stay too much heavy  :rant:) on Palm pre, dont works, then ligthting in real time. (making 3D ligths)

Kinds Regards,
Iván J.
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: Kitty Hello on 2011-Apr-29
What entity function do you mean?
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: mentalthink on 2011-Apr-30
Hi Gernoot, I think on Entity is called EntityGetY, EntityGetY and EntityGetZ, well I think this functions by the name have to do this. Really I don´t try them .

Thanks.
Iván J.
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: Kitty Hello on 2011-May-03
AHRGHHHH MY EYES..

Just kidding. The entity system does not use X_TRANSLATION but multiply/transform its own matrix and use X_MULTMATRIX later. That way I have the current matrix avaliable and can return the information.

I will include the commands you need in the next update. Sorry for that.
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: Kitty Hello on 2011-May-04
OK, have them in.

In the Samples/3D/PaperPlane2.gbas expand the example to:
Code (glbasic) Select

X_DRAWOBJ 0, 0 // Draw Object#0. Frame# is always 0 with user def. objects

LOCAL mat[]
X_GETMATRIX mat[]

X_DOT mat[12], mat[13], mat[14], 15, RGB(255,255,0)


The X_GETMATRIX gets you the matrix that you would have if you were doing an X_DRAWOBJ now. The matrix is a set of 3 axis (0,1,2 = X axis, 4,5,6 = Y; 8,9,10 = Z axis.
The 12,13,14 is the translation, thus your object's global x,y,z position. The axis might not be of unified length. That's a result of an X_SCALING operation.

Update will upload tomorrow somewhere. I'll post about it.
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: Qube on 2011-May-04
X_GETMATRIX - Sweet!!! - Can't wait to get my hands on that command. Many thanks indeed, Gernot, for adding the command in. It'll be a great help for the 3D side of things  :good:

Now all I need is sphere mapping support for iOS  =D
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: mentalthink on 2011-May-05
Hi Gernoot, sorry for the late reply, I don´t look your response.

About the commands don´t worry, when you can, my game I think to December not will be released, (I hope... is a faraonic work).

Thanks again for the code, and your support.
Kinds Regards,
Iván J.

Ps: Gennot, a command I wish, always if you have time, is the X_2_worldScreen and X_Screen2world, becuase I make a patch, whit  simple maths, but when I change the resolution of the device, the old values don´t works properly. In PC (this 2 commands )works, very fine, but on my Palm Pre, and Iphone don´t works, don´t return any value. Thanks again. (I don´t try on Beta Android)

Iván J.
Title: Re: HI, how get the coordinates of an 3d Objects ina 3d world ?¿
Post by: Kitty Hello on 2011-May-06
Yes, that's on my TODO.