Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Resize Prim, 1 direction

Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
02-04-2009 06:02
I hope this is a quicky, I want to increase/decrease a prim's size at one end (not both). The below script changes the z axis as the sun angle changes but does it to both ends (think thermometer here). Is the a way to direct the change to the upper part of the prim or do I have to reposition the whole prim each time? Many thanks as always.

//Code//

default
{
state_entry()
{
\\llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
vector sun = llGetSunDirection();
if(sun.z > 0)

{
float FLTz = sun.z;
llSay(0, "Touched.";);
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <1.0,0.0,0.0>, 0.7]);
llSetPrimitiveParams([PRIM_SIZE, <0.20,0.20,FLTz>]);
}
}
}

//Code Ends//
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
02-04-2009 06:11
yes, you have to move the prim too by half of what it was stretched

llSetPrimitiveParams([PRIM_POSITION,llGetPos() + <0.0,0.0,FLTz/2>])

you may also want to do all the llSetPrimitiveParams calls in one, because it gives a .2 second delay for each one so the next one won't get done until after the delay

llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE,
PRIM_COLOR, ALL_SIDES, <1.0,0.0,0.0>, 0.7,
PRIM_SIZE, <0.20,0.20,FLTz>,
PRIM_POSITION,llGetPos() + <0.0,0.0,FLTz/2>]);

edit:
just in case you have the prim rotated other than zero, this will make it move along it's own z axis, instead of the world's axis:

PRIM_POSITION,(llGetPos() + <0.0,0.0,FLTz/2>;)*llGetRot()
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
02-04-2009 06:25
I had to do something similar on a voting tool to show a dynamic bar graph (the SLOODLE Choice tool). If you path cut a prim in half (e.g. start the cut at 0.25 and end it at 0.75) then scaling it in script will only appear to resize it in one direction. That way you can avoid the movement.
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
02-04-2009 06:50
You guys are the best, I'll try both suggetions tonight. :)
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
02-04-2009 07:07
From: Pedro McMillan
I had to do something similar on a voting tool to show a dynamic bar graph (the SLOODLE Choice tool). If you path cut a prim in half (e.g. start the cut at 0.25 and end it at 0.75) then scaling it in script will only appear to resize it in one direction. That way you can avoid the movement.


problem with that is you can only scale it up to 5m. of course the op's script looks like it's only going up to 1 meter anyways. and i just noticed my example still moves it up even if the scale gets smaller. so the movement would need more logic. maybe a start position and then when it scales it would be PRIM_POSITION, (startpos + <0.0,0.0,FLTz/2>;)*llGetRot()
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369