I am using this script, I do not know where it came from, to have a little ball roam my platform. I figured out how to stopit form moving up and down, but it seems the prim it's self rotates as it goes. I would love to:
1. be able to stop the prim from rotating while it randomly moves.
2. be able determine the "front" so it always facing frint and turns before moving ina different direction. invision "tank tracks"
3. be able to sit on the object to ride it.
any help? is this a good start?
CODE
float radius = 15.0; //distance from starting point to wonder
float timeout = 7.0; //time between movement changes
float max_dist = 7.0; //max distance to move on x/y axis per timeout
vector start; //starting location, found on start/rez
//randomly move somewhere within the defined circle
random_move(){
vector pos; //new position
float dist; //distance from center
//calculate the new position
do{
//start with the current position
pos = llGetPos();
//randomly update x/y cords
pos.x += llFrand(max_dist * 2)-max_dist;
pos.y += llFrand(max_dist * 2)-max_dist;
//pos.z += llFrand(max_dist * 2)-max_dist;
//calculate dist = sqrt( diff(x)^2 + diff(y)^2 )
dist = ((pos.x - start.x) * (pos.x - start.x)) +
((pos.y - start.y) * (pos.y - start.y)) +
//((pos.z - start.z) * (pos.z - start.z));
dist = llSqrt(dist);
//if we are outside of the circles radius try again
}while(dist > radius);
//move to the new point
llMoveToTarget(pos,timeout);
}
default{
state_entry(){
//get starting point and init timer
start = llGetPos();
llSetTimerEvent(timeout);
//move the object
random_move();
}
on_rez(integer i){
//get starting point and init timer
start = llGetPos();
llSetTimerEvent(timeout);
//move the object
random_move();
}
timer(){
//move the object
random_move();
}
}