Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

reflexive (responsive) architecture scripts

Samuel Sharktooth
Registered User
Join date: 7 Mar 2009
Posts: 5
05-22-2009 22:11
hello is there anybody out there that understands reflexive (responsive) architecture scripts?

i am trying to modify keystones script 'Prim Moves X-Meters from Avatar, Returns Home X-Seconds after Avatar Leaves'. i would like to get the prim to move in a radial direction from the avatar rather than in a given vector direction.

i will pay anyone who can help as this is important for my design paper at university

email me [email]samdevo@gmail.com[/email]

thanks!!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-22-2009 22:37
conceptually, like this? stay at least 5m away from av, at the opposite end of a fixed point, ?

startPos;
llSetPos( llVecNorm( avPos - startPos ) * 5 + startPos );
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Samuel Sharktooth
Registered User
Join date: 7 Mar 2009
Posts: 5
05-22-2009 22:52
kind of... more like that as you walk towards the prim it moves away in a radial direction to you then as you walk away the object returns to its origional position.. thanks for your help anyways!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-22-2009 23:09
so as a spiral? plug a triangle formula into the above instead of a straight move away and you should get what you are looking for. perhaps check distance from av instead of distance from the field point.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Samuel Sharktooth
Registered User
Join date: 7 Mar 2009
Posts: 5
05-22-2009 23:16
yea so you create a shere around you as you walk through a 3d feild of prims. then they return to their origin.

heres the script // <span style=”display: inline”>For Keystone Bouchard. http://www.archsl.wordpress.com for an installation on Architecture Island, September 2007. Scripted by Fumon Kubo</span>

//Shared under Creative Commons Attribution-Share Alike 3.0 License


//Settings
//~Range in metres.
float range = 2.0;
//~Time in seconds for up tick.
float time = 0.001;
//~Time in seconds for down tick.
float downTime = 1.0;
//~Direction and distance (offset from origin when sense).
vector direction = <1.0,0.0,0.0>;
//~Local (TRUE or FALSE)
integer local = FALSE;
//Don't change bast here.
integer currentNum;
integer numMoves;

default {
state_entry() {
currentNum = 0;
numMoves = 0;
llSensorRepeat("", NULL_KEY, AGENT, range, PI, 0.25);
}
on_rez(integer ds){
currentNum = 0;
numMoves = 0;
}
sensor(integer num){
if(!currentNum){
currentNum = num;
llSetTimerEvent(time);
}
}
no_sensor(){
if(currentNum){
currentNum = FALSE;
llSetTimerEvent(downTime);
}
}
timer(){
if(currentNum){
if(local){
llSetPos(llGetPos() + (direction * llGetRot()));
}
else{
llSetPos(llGetPos() + direction);
}
numMoves++;
}
else if(numMoves > 0){
if(local){
llSetPos(llGetPos() - (direction * llGetRot()));
}
else{
llSetPos(llGetPos() - direction);
}
numMoves = numMoves - 1;
}
else if(numMoves == 0){
llSetTimerEvent(0.0);
}
}
}


as you cansee the direction and distance is vector based. im not sure how to make that based on avatar position.

thanks and sorry for bugging you
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-23-2009 07:50
CODE

if (llVecDist( avPos, basePos ) <5) {
newPos = avPos + llVecNorm( avPos - basePos ) * 5 ;
llSetPos( (newPos - <5, 0, 0> * llRotBetween( avPos, basePos )) * .75 );
}


I think...

that should do what I was originally suggesting. if the av is low left of the base pos the object will be 5m away upper right of base pos. as up though the field of detection to the upper left, the object will rotate down around the base pos to the lower right. reactivity is spiral on oblique approaches to the base pos, and more reactive the closer to base pos that the av gets. its spiralality varies in direct proportion to the obliquity of approach.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Samuel Sharktooth
Registered User
Join date: 7 Mar 2009
Posts: 5
05-23-2009 18:40
thanks alot