Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scaling in only one direction

Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
07-24-2007 19:46
I found some WIKI code that will let me rescale a prim. Basically, the key line of code is llSetPrimitiveParams(PRIM_SIZE, llGetScale() * scale) where scale is defined as float.

This causes the prim to "grow" in all three directions; x, y, and z. In my particular application I only want the prim to grow in the x direction. How do I change my line of code to do that?

Thank you!
Bartiloux
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
07-24-2007 20:26
The "scaling" function works with the <x, y, z> vector format...so...if you just want to change your x scaling...something like...

CODE


scale = llGetScale();
llSetScale(<scale.x + var, scale.y, scal.z>);



...would work.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
07-24-2007 20:35
You can't do it with just PRIM_SIZE. The location of the prim is always the center so if you change the size it will expand in all directions. To get around the problem you'd need to include a PRIM_POSITION in your call to llSetPrimitiveParams.

e.g.
llSetPrimitiveParams([PRIM_SIZE, llGetScale() * scale, PRIM_POSITION, <0,0,0>;)
(You'll need to work out the correct value for the PRIM_POSITION vector depending how you want to align the object. It'll probably be calculated using llGetPos() and the difference between the old size and the new size.)

FYI... In my experience the order of the options in llSetPrimitiveParams can sometimes make a difference. I've never worked out the exact situations where it causes problems, but if it doesn't seem to work try swapping them around.
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
07-25-2007 01:51
/54/81/189490/1.html#post1544238

You can find a script there to stretch a non-cut prim on one side only, shifting its center point so that one side stays in the same place while the other moves.
Domneth Dingson
Registered User
Join date: 20 Nov 2006
Posts: 126
07-29-2007 12:43
From: Kenn Nilsson
The "scaling" function works with the <x, y, z> vector format...so...if you just want to change your x scaling...something like...

CODE


scale = llGetScale();
llSetScale(<scale.x + var, scale.y, scal.z>);



...would work.

]

Can you explain this formula a bit please? I assume it runs the scale on a percentage to get the new location of said expanding prim?
Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
07-29-2007 15:36
Thank you for all your replies. For this particular application I opted to cut the prim in half so that the rescaling did what I wanted w/o having to take the extra steps of repositioning it with each iteration of scaling.

Sincerely,
Bartiloux Desmoulins