Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Stretching a prim on touch

Mickey Drayman
Registered User
Join date: 20 Feb 2007
Posts: 2
03-01-2007 23:47
Hi all.

Plase bear with me as its my first posting :)

I am looking for a way to smothly/slowly stretch a prim when touched and shrink on touch.

Scenario: A shop front that has a roller shuter

Any help on this would be appreciated, thanks
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-02-2007 00:35
From: Mickey Drayman
Hi all.

Plase bear with me as its my first posting :)

I am looking for a way to smothly/slowly stretch a prim when touched and shrink on touch.

Scenario: A shop front that has a roller shuter

Any help on this would be appreciated, thanks



llSetScale(vector scale) or llSetPrimitiveParams(list rule)


Be aware that changes in size are symetrical so you may have to change position as scale. If that is the case then I'd suggest using llSetPrimitiveParams as it only will perform both operations in one go and suffers only 0.2 sec penalty rather than 0.2 for each of llSetPos and llSetScale

You may also be able to just change the cut angle to get the same effect
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
03-02-2007 01:20
you may also be able to "Torture" the prim to get this to work as well (turn a box into a sphere, dimple it 50%, then turn it back into a box.

cut angle is simpler though.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
03-02-2007 01:21
you may also be able to "Torture" the prim to get this to work as well (turn a box into a sphere, dimple it 50%, then turn it back into a box.

See this thread for how
/8/da/27520/1.html

cut angle is simpler though, but the above is critical learning.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
03-02-2007 14:02
From: Winter Ventura
you may also be able to "Torture" the prim to get this to work as well (turn a box into a sphere, dimple it 50%, then turn it back into a box.
Unfortunately, doing this through script doesn't work. When doing a llSetPrimitiveParams PRIM_TYPE change to box/cylinder/prism, the dimple values get reset to 0 and 1.
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
03-02-2007 15:04
I make a set of blinds that does exactly that. Search for Blindz on SLExchange to take a look.

I achieve the effect by using llSetPrimitiveParams on a specially shaped prim. The prim's shape is such that the texture does not distort on the part of the prim that is moving up and down - I also do not resize the prim so that it retains the size that the user sets.

Blindz also resizes the prim if you want it to, so it adjusts its position to that it appears to get taller and shorter even though change in size affects both the top and bottom. Blindz includes a controller too so that you can open and close all Blindz in the area with a single click.

If you get stuck and cannot find anything suitable, I'd be happy to sell you a version that works just for a shop door or whatever.

-2fast
Mickey Drayman
Registered User
Join date: 20 Feb 2007
Posts: 2
03-05-2007 12:14
Thanks for the replies.

Still pondering on the idea and I realised I could use a sliding door that goes up and down instead of side to side. The only drawback is that when the door goes up it will be showing above the building as there is no wall to hide it in.

2fast4u, I looked at you Blindz but fail to see how I could implement it, maybe I am missing something, or too tired, LOL
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
03-05-2007 13:05
From: Mickey Drayman
2fast4u, I looked at you Blindz but fail to see how I could implement it, maybe I am missing something, or too tired, LOL


The blind could act as your door...then you would not have a the problem of having your door sticking out of the top of your store, or whatever. The only customization I think you might need is to change the texture...you can resize and position Blindz as you like. The home edition responds only to its owner, so you'll be the only person that can open or close the door/blind.

Since this is the Scripting Tips forum, and not a place for ads...here are some more details:

You can achieve a similar effect by resizing a prim but you'll have to make sure that it appears to stay in place (using llSetPos) as you resize it since both the top and bottom of the prim change when you increase or descrease the size.

Use llSetPrimitiveParams or llSetScale to resize, and then use llSetPos to move the prim by an offset to make sure it appears to stay in it's original position. Rounding errors over time could cause a bit of prim drift..but you can fix that by recording the prim's position in the open/closed state and then call llSetPos with those coordinates later (just thinking as I type). Here is some (untested code):

CODE

// untested and incomplete code
float scaleFactor=2.0;
llSetScale(<0.0,scaleFactor,0.0>);
//just an FYI: float moved = llVecDist(currentLocation,llGetPos());
llSetPos(llGetPos() + <0.0,0.0,(scaleFactor / 2)>);


The call to llSetPos is 1/2 of how much you scaled in the vertical (z) direction. Part of this code comes from Blindz resizing code (not the blind's movement..but parts of the code that execute when someone resizes the blind during setup) but I have not tested this. This also makes some assumptions about how you orient your prim, so you may have to adjust.

-2fast
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
03-05-2007 15:34
From: Deanna Trollop
Unfortunately, doing this through script doesn't work. When doing a llSetPrimitiveParams PRIM_TYPE change to box/cylinder/prism, the dimple values get reset to 0 and 1.

Yes, but for the intended application (as long as the shutter isn't taller than 5m) you wouldn't do it in script. You'd do it by hand before to get the centre-point where you want it.
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
03-06-2007 10:59
From: AJ DaSilva
You'd do it by hand before to get the centre-point where you want it.

Ah, ok... just for locating the pivot point, not iteratively to change size... missed that point.