Change the height of a cylinder? Progress bar - Like
|
Prolacta Genesis
Registered User
Join date: 30 May 2009
Posts: 5
|
08-24-2009 07:36
I having problems to change the height of a cylinder with its base clamped on the ground (because its reference point is located at the center of the cylinder) it is very difficult by using llSetScale (because I need to change the Z position and Height, and the minimum height is 0.010 and not 0). I was trying to use llSetPrimitiveParams with PRIM_TYPE and PRIM_TYPE_CYLINDER with no results. I need to control the height of the cylinder just like a "Windows Progress Bar" from 0% to 100%. Can anyone help me? thanks in adavance
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
08-24-2009 07:43
Something like... vector size = < ... >; vector pos = < ... >;
llSetPrimitiveParams ([PRIM_POSITION , pos, PRIM_SIZE, size]);
...will set the position and size with one call. The position is for the center of the prim so you'll probably want to update .z position based on half the height. Like, if you want the bottom to be at position.z =50.0, set position to be 50.0 + (size.z / 2.0). Untested but probably close...
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
08-24-2009 07:58
Take a look at http://wiki.secondlife.com/wiki/Curtain_script for an example of how to do this with Meade's method, and try changing the offset to offset.z rather than offset.x. Though since you've got the problem of moving it from 0.0, " and the minimum height is 0.010 and not 0", it might be simplest, depending on how long the progress bar is, to bury it so the top of the un-extended cylinder is flush with the ground -- i.e. the centre point is just below the ground -- and let it grow in both directions.
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
08-24-2009 08:01
Another option is to keep the prim the same size but mess with the texture offset..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Rime Wirsing
Color me gone
Join date: 31 Dec 2008
Posts: 345
|
08-24-2009 08:10
Just had a quick play and E slice can take the height down to nearly 0 without moving the prim. Maybe just change that in script?
One nice thing about slice is the texture does not move so you could have a graduated texture or green/yellow/red to indicate measure say and not have it mess up.
Rime
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
08-24-2009 08:48
From: Rime Wirsing Just had a quick play and E slice can take the height down to nearly 0 without moving the prim. Maybe just change that in script?
One nice thing about slice is the texture does not move so you could have a graduated texture or green/yellow/red to indicate measure say and not have it mess up.
Rime Unfortunately, you can't slice stuff with llSetPrimitiveParams, which I agree would be a very neat solution to a lot of problems if only you could. See http://jira.secondlife.com/browse/MISC-2847
|
Prolacta Genesis
Registered User
Join date: 30 May 2009
Posts: 5
|
E slice
08-24-2009 08:50
Yes Rime, I was thinking in the E slice (to take the height down to 0 without moving or changing the main-height of the prim). But I can't do that using scripts (the function llSetPrimitiveParams seems not having that feature).
|
Rime Wirsing
Color me gone
Join date: 31 Dec 2008
Posts: 345
|
08-24-2009 09:52
Ahhhh, yes, well... that would be a bit of a issue then. Tried to vote on the Jira but getting page not found. Will go vote later.
Rime
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
08-24-2009 10:20
It's a bit more complicated but couldn't you change the prim type to something that slices, set the slice then change it back to a cylinder all in the same call?
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
08-24-2009 10:26
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
08-24-2009 14:15
From: Meade Paravane It's a bit more complicated but couldn't you change the prim type to something that slices, set the slice then change it back to a cylinder all in the same call? apparently no... they've quietly updated the primitive params call so that changing type wipes out (or at least defaults) params they haven't included... there's a jira (I was VERY surprised to find that issue, and more than a little pissed off)
_____________________
| | . "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... | - 
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
08-24-2009 14:35
From: Void Singer apparently no... they've quietly updated the primitive params call so that changing type wipes out (or at least defaults) params they haven't included... there's a jira (I was VERY surprised to find that issue, and more than a little pissed off) /me blinks. Wow... Wonder how much content that broke.. Or is one of those things that just happens on a recompile?
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
08-24-2009 15:01
This is from the thread i referenced. A candle that burns at a set rate. You will notice that you have to adjust scale and then set pos by 1/2 the scale adjustment. integer on = 1; vector startscale; vector startpos; float meltpercent = 0.1; float melt; vector move; float delay = 0.5;
startover() { llSetScale(startscale); llSetPos(startpos); }
default { state_entry() { startscale = llGetScale(); startpos = llGetLocalPos(); melt = startscale.z * meltpercent; move = <0.0, 0.0, melt >; } touch_start(integer total_number) { if (on) { llSetTimerEvent(delay); } else { llSetTimerEvent(0.0); startover(); } on = !on; } timer() { vector scale = llGetScale(); if (scale.z <= melt) { startover(); } else { llSetScale(llGetScale() - move); llSetPos(llGetLocalPos() - (<0.0, 0.0, melt / 2 >) * llGetLocalRot()); } } }
Cool! That is from when Ruthven was just learning here. From total noob to Scripting Forum God in just a few short months 
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
08-24-2009 19:07
From: Jesse Barnett Cool! That is from when Ruthven was just learning here. From total noob to Scripting Forum God in just a few short months  lmao, i hardly think i'm a scripting forum god, i still have LOTS to learn. and i took a bit of a break from sl and forgot a lot of what i learned lol. when writing scripts lately, i'm constantly checking the wikis and the forum for examples to help me understand functions better.
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
08-24-2009 19:11
From: Ruthven Willenov lmao, i hardly think i'm a scripting forum god, i still have LOTS to learn. and i took a bit of a break from sl and forgot a lot of what i learned lol. when writing scripts lately, i'm constantly checking the wikis and the forum for examples to help me understand functions better. And modest too!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
Prolacta Genesis
Registered User
Join date: 30 May 2009
Posts: 5
|
Thank you
08-25-2009 06:06
Thank you friends for your invaluable help. I'm using this solution and works fine:
llSetPrimitiveParams with PRIM_SIZE and PRIM_POSITION
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
08-25-2009 15:31
From: Meade Paravane /me blinks. Wow...
Wonder how much content that broke.. Or is one of those things that just happens on a recompile? probably not much content per se (not many people willing to jump through that hoop on a regular basis), but prim torture? completely out the window =(
_____________________
| | . "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... | - 
|