|
Silvaranth Kronsage
Registered User
Join date: 12 Jun 2006
Posts: 9
|
08-13-2006 12:30
I have a column of fog that's a box and I'd like to have it slowly float down to the floor and dissappear when someone touches another object. then I want it to reappear and float down from the ceiling when they touch the object again. My basic problem is that I need to resize the column over time, I've come up with a For loop to handle this. listen(integer channel, string name, key owner, string message) { if(message == "shrink") { //get current column size currentscale = llGetScale(); //get current column position currentPos = llGetPos(); //divide the current height by the number of times you want it to resize changeZ = currentscale.z / 50; //divide that by 2 since it resizes both sides at the same time changePosZ = changeZ / 2; changePos = currentPos;
integer i; for(i=0; i<50; i++) { //make column smaller changescale.z = changescale.z - changeZ; llSetScale(changescale); //make column stay on the floor by moving down changePos.z = changePos.z - changePosZ; llSetPos(changePos); //set small pause if needed llSleep(0.01); } //move flattened column to where the top of the original sized column was to get it ready to expand //get flattened column position currentPos = llGetPos(); //get flattened column height currentscale = llGetScale(); //get the height of the original column and move flattened column to there currentPos.z = currentPos.z + (changeZ * 50) - currentscale.z; llSetPos(currentPos); } if(message == "expand") { //make column expand toward the floor } }
I'm having 2 problems with this that I wasn't having yesterday first is that my for loop isn't resizing the column, the SetPos call is moving it down though. An individual SetScale call does resize the column however. Second is that it seems as though my code stops executing immediately after the for loop, it doesn't move up at all. Odd behavior. But there is one other question that I had and that is: Is there anyway to slow down the resizing animation of a single llSetScale call? It doesn't resize it in one deft frame so I know it computes some sort of animation, I just wonder if there's a way to slow it down. Thanks!
|
|
Silvaranth Kronsage
Registered User
Join date: 12 Jun 2006
Posts: 9
|
08-13-2006 12:49
Well it would help if I initialized my changescale vector... added changescale = currentscale; It works now, but my question still stands, is there an easier way to make this work without the for loop and incrementing?
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
08-13-2006 13:51
This sounds like a job for llParticleSystem, but I might be misunderstanding what the desired effect is.
|
|
Silvaranth Kronsage
Registered User
Join date: 12 Jun 2006
Posts: 9
|
08-13-2006 14:22
I tried using a particle system effect, but it didn't do what I desired. The system is also more complicated than that, I'm adapting a vendor system to the theme of my house and the "fog" effect is surrounding the item being displayed, this vendor system can also display the actual item by rezzing it so it's a pretty nice effect. I'm using an oriental style alter with a hole in the top of it for the "fog" to fall through and hit the ground and kinda spread out before dissapating. It's hard to describe but I want the alter to close up after a certain period of inactivity and the fog effect to stop and it will go back to being just a plain looking piece of furniture until someone comes by and touches it again.
And also with the particle system you deal with textures not rezzing and you have ugly gray squares all over.
Come see it in Rydal at 205, 123, 22
I've got a simple test system right next to the actual thing Red block shrinks, Green block expands
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
08-13-2006 14:46
There's no way to change how quickly the client shows the changes, but both the movement and the scaling will happen at the same time if you use llSetPrimitiveParams.
Alternatively, for smooth movement, you could use llTargetOmega and time the scaling appropriately, so at least one thing will be smooth.
|