|
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
|
05-15-2006 11:43
my brain hurts ~.~  anyways, what im having problems with is i need to get a vector (velocity from llRezObject. The Object is rezzed from an attachment) so point to a detected avatar. I was looking over the wiki and couldnt find anything, and rotations make my brain hurt lol. If anyone knows how to find this i would greatly appreciate it. 
|
|
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
|
05-15-2006 17:39
sensor(integer n) { vector relative_pos = llDetectedPos(0) - llGetPos(); rotation rot_2_detected = llRotBetween(llVecNorm(relative_pos), <1.0, 0.0, 0.0>);
// This will rez "object" one meter away from you in the direction of the first thing detected, moving at one meter per second toward that detected thing, with the X-Axis of "object" pointed at that detected thing. llRezObject("object", llGetPos() + (<1.0, 0.0, 0.0> * rot_2_detected), <1.0, 0.0, 0.0> * rot_2_detected, rot_2_detected, 0); }
|
|
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
|
05-15-2006 18:30
 TY your a life saver
|
|
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
|
05-16-2006 09:26
hmmm, doesnt seem to work  it shoots it, but its not even close to be shooting in the direction of the person. sensor(integer num_detected) { integer i; for(i=0;i<num_detected;i++) { vector relative_pos = llDetectedPos(i) - llGetPos(); rotation rot_2_detected = llRotBetween(llVecNorm(relative_pos), <1.0, 0.0, 0.0>); Debug((string)relative_pos + " | " + (string)rot_2_detected); // This will rez "object" one meter away from you in the direction of the first thing detected, moving at one meter per second toward that detected thing, with the X-Axis of "object" pointed at that detected thing. llRezObject(object, llGetPos() + (<1, 0.0, 0.0> * rot_2_detected), <1.0, 0.0, 0.0> * rot_2_detected, rot_2_detected, 0); } }
|
|
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
|
05-16-2006 13:02
From: Gattz Gilman hmmm, doesnt seem to work  it shoots it, but its not even close to be shooting in the direction of the person. ooops, I think I screwed up and reversed something  . this: rotation rot_2_detected = llRotBetween(llVecNorm(relative_pos), <1.0, 0.0, 0.0>  ; should have been... this: rotation rot_2_detected = llRotBetween(<1.0, 0.0, 0.0>, llVecNorm(relative_pos)); sensor(integer n) { vector relative_pos = llDetectedPos(0) - llGetPos(); rotation rot_2_detected = llRotBetween(<1.0, 0.0, 0.0>, llVecNorm(relative_pos));
// This will rez "object" one meter away from you in the direction of the first thing detected, moving at one meter per second toward that detected thing, with the X-Axis of "object" pointed at that detected thing. llRezObject("object", llGetPos() + (<1.0, 0.0, 0.0> * rot_2_detected), <1.0, 0.0, 0.0> * rot_2_detected, rot_2_detected, 0); } or for your code... sensor(integer num_detected) { integer i; for(i=0;i<num_detected;i++) { vector relative_pos = llDetectedPos(i) - llGetPos(); rotation rot_2_detected = llRotBetween(<1.0, 0.0, 0.0>, llVecNorm(relative_pos)); Debug((string)relative_pos + " | " + (string)rot_2_detected); // This will rez "object" one meter away from you in the direction of the first thing detected, moving at one meter per second toward that detected thing, with the X-Axis of "object" pointed at that detected thing. llRezObject(object, llGetPos() + (<1, 0.0, 0.0> * rot_2_detected), <1.0, 0.0, 0.0> * rot_2_detected, rot_2_detected, 0); } }
|