PVector pos;
float yaw;
float pitch;
float roll;
float[][] rmx;
PVector posinit;
void setup() {
size(640, 360, P3D);
pos = new PVector(width/2, height/2, 0);
posinit = new PVector(width/2, height/2, 0);
yaw = PI/8;
pitch = PI/12;
roll = PI/10;
rmx = {{cos(yaw)*cos(pitch), cos(yaw)*sin(pitch)*cos(roll) - sin(yaw)*cos(roll), cos(yaw)*sin(pitch)*cos(roll) + sin(yaw)*sin(roll) },
{sin(yaw)*cos(pitch), sin(yaw)*sin(pitch)*sin(roll) + cos(yaw)*cos(roll), sin(yaw)*sin(pitch)*cos(roll) - cos(yaw)*sin(roll) },
{-sin(pitch), cos(pitch)*sin(roll), cos(pitch)*cos(roll)}};
}
it shows me an error called “bad identifier” at line where i put the values for “rmx”
tensor
2
my apologies if its something stupid
glv
3
Hello,
Consider:
rmx = new float [] []
{
{cos(yaw)*cos(pitch), cos(yaw)*sin(pitch)*cos(roll) - sin(yaw)*cos(roll), cos(yaw)*sin(pitch)*cos(roll) + sin(yaw)*sin(roll) },
{sin(yaw)*cos(pitch), sin(yaw)*sin(pitch)*sin(roll) + cos(yaw)*cos(roll), sin(yaw)*sin(pitch)*cos(roll) - cos(yaw)*sin(roll) },
{-sin(pitch), cos(pitch)*sin(roll), cos(pitch)*cos(roll) }
};
I looked for some references on initializing an array and found this:
:)
1 Like
Dunno might be that this only works outside any function
tensor
5
thanks fam it worked
i just had to initialize it once outside setup() and then put the values like you did inside the setup
2 Likes
tensor
6
its weird that if i do the entire array thing outside setup then it doesnt give me error but doesnt work either
1 Like