how to divide Vector?

Posted By: CocaCola

how to divide Vector? - 06/09/16 12:41

Hello,
IŽd tried to divide 2 vectors, but it doesenŽt work.
I get a E1513 Error. but I see the you model with I created
What is wrong?
Code:
VECTOR* temp;
VECTOR* temp2;
CONTACT* c = ent_getvertex(you,NULL,i);
CONTACT* c2 = ent_getvertex(you,NULL,i-2);
while (1) {
	if(key_space){
        while(key_space)wait(1);
vec_set(temp.x,c2.x);
vec_set(temp2.x,c.x);
temp.x /=temp2.x;
temp.y /=temp2.y;
temp.z /=temp2.z;
	             }
	wait(1);
	}

Posted By: 3run

Re: how to divide Vector? - 06/09/16 12:50

Make sure that you aren't deviding by zero.
Posted By: CocaCola

Re: how to divide Vector? - 06/09/16 12:55

yes, it was that problem, THE nullvector X}
whats about the c.v?
ist the vertex position c.v or c.x?
Posted By: 3run

Re: how to divide Vector? - 06/09/16 13:21

As the manual says, vertex position is stored in c.x,y,z
Originally Posted By: Manual
c.x,y,z - VECTOR containing the vertex position in local entity coordinates, set by ent_getvertex.
Take a look into the manual, it's almost always helpful:
ent_getvertex(ENTITY* ent, CONTACT* c, var num);
Posted By: CocaCola

Re: how to divide Vector? - 06/09/16 14:58

IŽm not shure with the read in the manual. OK?
edit: I fond in the example: c.v.y += 5.0;
edit2: my second problem was the * in the vector declaration
Posted By: MasterQ32

Re: how to divide Vector? - 06/09/16 17:21

use vectors and not pointers to vectors. you are currently destroying random ram
.
© 2024 lite-C Forums