Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Resize and Move Prim

Dudeney Ge
EduNation Archipelago
Join date: 21 Jul 2006
Posts: 95
04-08-2007 10:59
Hi,

This is probably very simple for some of you, but I can't get it to work. The following script resizes and moves a prim - the problem I have with it is that the script needs to know the starting position of the prim:

CODE

vector smallpos = <56.000, 28.000, 32.000>;
vector largepos = <56.000, 28.000, 33.000>;
integer TouchSW;

default
{
touch_start(integer total_number)
{
if(!TouchSW)
{
while(llVecDist(llGetPos(), smallpos) != 0)
{
llSetPos(smallpos);
}
llSetScale(<.380, 0.010, 0.200>);
}
else
{
while(llVecDist(llGetPos(), largepos) != 0)
{
llSetPos(largepos);
}
llSetScale(<3.8, 0.010, 2.800>);
}
TouchSW = !TouchSW;
}
}


Can anybody help me make it so that the script *gets* the local position of the prim and then does the rest, so it doesn;t have to be manually entered into the script itself?

Thanks in advance

DG
Ricky Yates
(searching...)
Join date: 28 Jan 2007
Posts: 809
04-08-2007 11:27
Why don't you do it this way? (I fully realise that the code could be somewhat optimized)

CODE
vector small_movement = <0.0, 0.0, -1.0>;
vector large_movement = <0.0, 0.0, 1.0>;
vector small_scale = <3.8, 0.01, 0.2>;
vector large_scale = <3.8, 0.01, 2.8>;
vector new_pos;
vector new_scale;
integer is_large;

default
{
touch_start(integer total_number)
{
if(is_large)
{
new_pos = llGetPos() + small_movement;
new_scale = small_scale;
}
else
{
new_pos = llGetPos() + large_movement;
new_scale = large_scale;
}
while(llVecDist(llGetPos(), new_pos) != 0)
{
llSetPos(new_pos);
}
llSetScale(new_scale);
is_large = ! is_large;
}
}