Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scaling in one-direction

Strop Razor
Registered User
Join date: 10 Aug 2008
Posts: 4
03-29-2009 13:05
I want an object to grow and shrink under the influence of a script, ( touched, timer, etc.)
But llSetScale(<0.1,0,0>;) grows from the middle in both the positive and negative X directions. What if you want to only grow in the Positive direction?
In Edit, the stretch function has a parameter for one-end only. Does scripting?
Or do I have to resort to a fancy equation, strech both ends by .05 and reposition the center back .05 to grow one end by .1?
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
03-29-2009 14:47
You've got the solution in the last part of your post. Shrinking/growing always happens from the center of an object. So after resizing, you'll have to reposition the object. The only way to get around this would be to cut the object in half. Growing/shrinking would still happen in both directions, but only half of it would be visible.
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
03-29-2009 16:47
There's a useful example of how to do it at http://wiki.secondlife.com/wiki/Curtain_script
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
03-29-2009 21:12
you can do it in 2 calls with
starting with a cube that's <0.25,0.5,0.5> at position <20.0,20.0,20.0> at a zero rotation

vector sizechng = <0.25,0.0,0.0>

llSetScale(llGetScale() + sizechng);//returns <0.5,0.5,0.5>
llSetPos(llGetPos() + (sizechng /2)*llGetLocalRot());//Returns <20.125,20.0,20.0>

basically it moves it half of the amount it changes size so that the negative end stays fixed

you can do it in one call with

llSetPrimitiveParam([PRIM_SIZE,llGetScale() + sizechng,PRIM_POSITION,llGetPos() + (sizechng /2)*llGetLocalRot()]);

something like that, not in world to check it
_____________________
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
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-30-2009 04:42
if you only need it to grow in one direction and never the opposite, you could cut the prim like haruki suggests

to limit x or y growth use either
.125 & .625
or
.375 & .825
to limit z growth, use dimpling
.00 & .50
or
.50 & .00
you can even combine them to get x and z, or y and z limits.

then when you change sizes it will only change in one direction.

Caveat: you have to double your size calculation and your maximum size in that direction becomes 5m for normal prims. z dimples are ignored by flexi's and IIRC sculpts too
_____________________
|
| . "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...
| -
Strop Razor
Registered User
Join date: 10 Aug 2008
Posts: 4
03-30-2009 10:40
From: Ruthven Willenov

you can do it in one call with

llSetPrimitiveParam([PRIM_SIZE,llGetScale() + sizechng,PRIM_POSITION,llGetPos() + (sizechng /2)*llGetLocalRot()]);

something like that, not in world to check it


Thank you all. Especially Ruthven; this one call version looks particularly good.