Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 13,972 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
vec_set Looks strange for me #321393
04/28/10 20:36
04/28/10 20:36
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
I was wondering why do I need to pass the x component to the vec_set function to set the three components (XyZ)

vec_set(my.x,your.x);

I Just need to know how does the function extract the y and Z components of the vector from the x component only

may be my Question is very trivial for most of you, but I'm coming from a cpp background and we don't deal with vectors that way

Re: vec_set Looks strange for me [Re: Badrizmo] #321397
04/28/10 20:49
04/28/10 20:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
vec_set expects a VECTOR. A VECTOR is three vars in a row.

my.x is not actually a vector, since my is an entity, but within that entity is stored x, y, z in the same order as in a VECTOR. When you say:

vec_set(my.x, your.x);

Lite-C actually knows that this function expects a place in memory (in the manual, the paramaters are VECTOR*, not just VECTOR), so it passes the memory address of my.x, and the function, thinking it has the memory position of a VECTOR, sets each component appropriately.

I hope that makes sense. I'm unwell at the moment.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: vec_set Looks strange for me [Re: Badrizmo] #321398
04/28/10 20:50
04/28/10 20:50
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
it´s just the indicator for using the position vectors of the entities here wink
if you use f.i. .pan instead of .x then it would mean that you want to work with the euler angles.

EDIT: the mighty Julz was faster-.-

Last edited by Hummel; 04/28/10 20:51.
Re: vec_set Looks strange for me [Re: Hummel] #321405
04/28/10 22:25
04/28/10 22:25
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
c++ vectors and gamestudio vectors are completely diffrent things, vector is a simple struct consisting from x,y and z variables.


3333333333
Re: vec_set Looks strange for me [Re: JibbSmart] #321662
05/01/10 09:59
05/01/10 09:59
Joined: Apr 2010
Posts: 56
Badrizmo Offline OP
Junior Member
Badrizmo  Offline OP
Junior Member

Joined: Apr 2010
Posts: 56
Thanks a lot julz for your excellent explanation, which helped me understand how Litec operates from under the hood.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1