Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 5,796 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
if-term problem #253891
02/27/09 15:02
02/27/09 15:02
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
Hello,

I want to use an if-term where I compare a vector:

how do I do this? I have already tried out:
VECTOR* vector1;

if (vector1.x < 1)
...

but it does not work!


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: if-term problem [Re: MPQ] #253892
02/27/09 15:06
02/27/09 15:06
Joined: Aug 2003
Posts: 7,440
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,440
Red Dwarf
vector1[0]


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: if-term problem [Re: Michael_Schwarz] #253893
02/27/09 15:13
02/27/09 15:13
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
If you want to compare to the magnitude of a vector you can use vec_length.

And if vector1 is a local vector, you can omit the asterik (*) in its declaration.

Re: if-term problem [Re: Saturnus] #253907
02/27/09 16:06
02/27/09 16:06
Joined: Jan 2009
Posts: 86
Brasil - RS
D
DiegoFloor Offline
Junior Member
DiegoFloor  Offline
Junior Member
D

Joined: Jan 2009
Posts: 86
Brasil - RS
Complementing the Kombucha's answer, what exactly do you want to compare? What you did there works, but it's only comparing the x component of vector1.

Re: if-term problem [Re: DiegoFloor] #253911
02/27/09 17:28
02/27/09 17:28
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
yeah, I only want to use the x-component of the term

like: if the x-value of the vector is under 10, do sth. (thats waht i want ;))

vec_length is not what i need because I only want to get the x-value of the vector and not the whole xyz-vector

Last edited by MPQ; 02/27/09 17:35.

new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: if-term problem [Re: MPQ] #253960
02/27/09 23:52
02/27/09 23:52
Joined: Aug 2003
Posts: 7,440
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,440
Red Dwarf
I'll clarify more:

use vector1[0] instead of vector1.x


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: if-term problem [Re: Michael_Schwarz] #253967
02/28/09 01:02
02/28/09 01:02
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
AND as long as the vector is being correctly declares and initialised,
[b]if (vector1.x < 1)[.b] should work fine for just testing the X portion.

To clarify the defining,
Code:
VECTOR* vector1 = { x=0; y=0; z=0; }    //if OUTSIDE a function (global variable/vector)

VECTOR vector1;       //needs both these lines in this order
vec_zero(vector1);    //  if inside a function(local variable/vector)



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

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