If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Jim121
Posts: 21 Joined: Sat Oct 11, 2008 2:23 am
Post
by Jim121 » Tue Nov 18, 2008 8:14 am
I the following code in my program but the compiler says that x, y and z are not declared. thanks in advance.
Code: Select all
int ang(float x,float y, float z, float angle_xz, float angle_yz, float distance){
if(angle_xz<=90){
y=distance*sin(angle_xz/60);
z=distance*cos(angle_xz/60);
}
if(angle_xz>90 && angle_xz<=180){
y=distance*sin((angle_xz-90)/60);
z=distance*cos((angle_xz-90)/60);
}
if(angle_xz>180 && angle_xz<=270){
y=distance*sin((angle_xz-180)/60);
z=distance*cos((angle_xz-180)/60);
}
if(angle_xz>270){
y=distance*sin((angle_xz-270)/60);
z=distance*cos((angle_xz-270)/60);
}
}
Code: Select all
ang(rect_basic_bronze_axe[i].x,rect_basic_bronze_axe[i].y,rect_basic_bronze_axe[i].z,rect_basic_bronze_axe[i].direction_xz,
0,10);
rect_basic_bronze_axe[i].x=rect_basic_bronze_axe[i].x+x;
rect_basic_bronze_axe[i].y=rect_basic_bronze_axe[i].y+y;
rect_basic_bronze_axe[i].z=rect_basic_bronze_axe[i].z+z;
aungsithu
Posts: 39 Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:
Post
by aungsithu » Tue Nov 18, 2008 8:32 am
rect_basic_bronze_axe.x=rect_basic_bronze_axe.x+x;
rect_basic_bronze_axe.y=rect_basic_bronze_axe.y+y;
rect_basic_bronze_axe.z=rect_basic_bronze_axe.z+z;
Where these underlined x,y,z came from?
JP
Posts: 4526 Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:
Post
by JP » Tue Nov 18, 2008 9:03 am
Yeah your compiler should have told you which line numbers give the errors and will probably pointed to the same ones as aungsithu pointed out. From your code snippet they certainly don't seem to be coming from anywhere sensible but it's hard to tell!
asparagusx
Posts: 81 Joined: Thu Oct 16, 2008 6:50 am
Post
by asparagusx » Tue Nov 18, 2008 10:36 am
I also can't see how you are going to change the values in the ang function :
int ang(float x,float y, float z, float angle_xz, float angle_yz, float distance)
In the code you are changing x,y,z, but they are not declared correclty - you either have to define them as
float &x or
float *x (as an example)
if declared as float *
then use
*x = ........
Anton
Jim121
Posts: 21 Joined: Sat Oct 11, 2008 2:23 am
Post
by Jim121 » Sat Nov 29, 2008 2:57 am
thanks
I should have seen it before the variables are not declared as global variables meaning that any where out of the sub they would be existent.