0 registered members (),
1,295
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to retrieve the x,y,z of an vector [solved]
#350635
12/17/10 19:46
12/17/10 19:46
|
Joined: Sep 2010
Posts: 82
peteredlin
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 82
|
Hi, i have a vector but i want to use it's x,y,z value's indepandently , how can i read only one?
Thanks in advance
Last edited by peteredlin; 12/18/10 08:19.
|
|
|
Re: How to retrieve the x,y,z of an vector
[Re: peteredlin]
#350638
12/17/10 20:09
12/17/10 20:09
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Same goes for the y and z component
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: How to retrieve the x,y,z of an vector
[Re: WretchedSid]
#350639
12/17/10 20:20
12/17/10 20:20
|
Joined: Sep 2010
Posts: 82
peteredlin
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 82
|
I got the following code which i cant figure out how to work right:
VECTOR newspw;
vec_for_vertex(newspw,chasis,60);
cylinder = ent_create("cube\\cylinder\\cylinder.mdl",spawnp,NULL);
cylinder.x = newspw.x;
Last edited by peteredlin; 12/17/10 20:26.
|
|
|
Re: How to retrieve the x,y,z of an vector
[Re: peteredlin]
#350640
12/17/10 20:46
12/17/10 20:46
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
You forgot to mention what you expected as result ![wink wink](/ubb7/images/graemlins/default_dark/wink.gif)
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: How to retrieve the x,y,z of an vector
[Re: WretchedSid]
#350643
12/17/10 21:09
12/17/10 21:09
|
Joined: Sep 2010
Posts: 82
peteredlin
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 82
|
I want to change the x position of the cylinder. using the coordinate from newspw...
My basic question is: how to change the position of an entity using a vector as source.?
Last edited by peteredlin; 12/17/10 21:14.
|
|
|
Re: How to retrieve the x,y,z of an vector
[Re: peteredlin]
#350653
12/17/10 21:54
12/17/10 21:54
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Well, the code is correct. I don't see why it shouldn't work.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: How to retrieve the x,y,z of an vector
[Re: peteredlin]
#350665
12/18/10 00:21
12/18/10 00:21
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
We'd need to see more of the code but a stab in the dark, you've created a boolean pointer somewhere and are storing the entity in this (won't show any problems in the compiler) but the BOOLEAN data type doesn't have a .x property, make sure that cylinder is an ENTITY pointer. basically what i'm trying to say:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
BOOL bool_temp;
void main(){
BOOL bool_temp;
level_load(NULL);
bool_temp = ent_create(CUBE_MDL, vector(1, 1, 1), NULL);
bool_temp.x = 1;
//vec_set(bool_temp, vector(1, 1, 1));
}
change to:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
ENTITY* ent_temp;
void main(){
level_load(NULL);
ent_temp = ent_create(CUBE_MDL, vector(1, 1, 1), NULL);
ent_temp.x = 1;
}
or .x inside the entities on function would work
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
action move_me(){
while(me){
my.x += time_step;
wait(1);
}
}
void main(){
level_load(NULL);
ent_create(CUBE_MDL, vector(1, 1, 1), move_me);
}
Hope this helps (and makes sense) ENTITY*
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|