vec_rotate problem

Posted By: Why_Do_I_Die

vec_rotate problem - 05/26/06 21:07

This is a pretty noob question , I want to rotate a model around another model using vec rotate , but i cant seem to get the instruction to do anything , here is the code i have for a cube model . the code is straight from the manual , though when i run the level the cube does absolutely nothing , anyone know what i'm missing ?

entity* cube;
var direction[3] = 90, 50, 50;
var angle[3] = 90, 45, 0;
action rotate_cube
{
wait(1);
cube=my;
while(1)
{
vec_rotate(my.pan,angle);
wait(1);
}
}
Posted By: xXxGuitar511

Re: vec_rotate problem - 05/26/06 23:25

yeah.... um... Thats actually not it at all... You need to state exactly how you want it to work. You want one entity to "orbit" around another model?
Posted By: raiden

Re: vec_rotate problem - 05/29/06 04:22

I think your looking for something like this.
Code:

entity* cube;

action rotateCube {
cube = me;
}

action baseCube {
while(cube == null) { wait(1); }
var counter;
while(1) {
vec_set(temp,vector(-100,0,0));
vec_rotate(temp,counter);
vec_add(temp,my.x);
vec_set(cube.x,temp);
counter += 3 * time;
wait(1);
}
}


or......
Code:

action baseCube {
while(cube == null) { wait(1); }
var counter;
while(1) {
cube.x = my.x + sin(counter) * -100;
cube.y = my.y + cos(counter) * -100;
cube.z = my.z;
counter += 3 * time;
wait(1);
}
}



Attach rotateCube to the entity you want to circle around baseCube.

Have fun

-raiden
Posted By: Why_Do_I_Die

Re: vec_rotate problem - 05/29/06 04:33

Koo , thnx raiden , will give the code a try , i'm a noob coder so a lot of times i get stuck trying to implement code i've never used before.
Posted By: raiden

Re: vec_rotate problem - 05/29/06 05:58

Your welcome, if you have any problems getting it to work, just let me know.

-raiden
© 2023 lite-C Forums