Wearable object that moves?
|
|
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
|
07-12-2007 14:17
For a simple little project, this has been anything but.  I'm working on a single-prim object (a balloon) that attaches to the spine and is positioned above and to the left of the avatar's head. No strings, yet. What I'd like it to do is, as an attached object, bob up and down gently and periodically change position within a random set of variables. I know very, very little about scripting, and don't even know A. if this is possible, and B. how I would go about making it work if it is possible. I've had some luck with the following, which I nabbed from here: vector here; vector there; float interval; integer going = 1;
default { state_entry() { here = llGetPos(); there = here + < 0,0, 2>; interval = 4; llSetTimerEvent(interval); llMoveToTarget( here, interval); } timer() { vector next; if( going ) next = there; else next = here; llMoveToTarget(next, interval ); going = !going; }
} ...Unfortunately, it also makes my avatar bob up and down gently right along with the balloon object.  ...Help??
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
07-12-2007 14:27
If it's just the kind of balloon someone would carry around, have you tried just setting it as a flexible prim?
|
|
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
|
07-12-2007 14:30
Well, it's a sculpted prim, yasee. ^^;; Don't think those can be set to flexi, yet?
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
07-12-2007 14:59
llMoveToTarget is going to move the whole avatar when used in an attachment. So if its not attached it would work if you used it to move to positions relative to the avatar using a sensor (this would be like a 'follower' script for pets etc).
For an attachment I thinkyou can use llSetPos(vector pos), which takes a position relative to the attachment point (the starting location can be found with llGetLocalPos()).
Unfortunately you can't do the slow damping thing with that so you would have to use a timer and a lot of little moves to get a bobbing effect, unless there is another way? Also the string will likely be a challenge as you can move the balloon, or the baloon and string.. but keeping them attached to eachother and to the hand might require some clever work, possibly with resizing/repositioning the string.
|
|
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
|
07-12-2007 15:18
From: Shadow Subagja Unfortunately you can't do the slow damping thing with that so you would have to use a timer and a lot of little moves to get a bobbing effect, unless there is another way? Also the string will likely be a challenge as you can move the balloon, or the baloon and string.. but keeping them attached to eachother and to the hand might require some clever work, possibly with resizing/repositioning the string.
Ahha! Yeah, I had tried the timer and all previously, but couldn't get it to work without looking quiet jerky and odd (I'm just not that good with timers!) ...I think I might be better off just making it follow. Seems simpler, and would amuse folks who remember seeing The Red Balloon as kids, as well. Alternately, could one fake a string using a targeted particle script? Is there a way to offset the target so as to make that look correct, I wonder? Hm.
|
|
Cryas Tokhes
Great Googley Moogley...
Join date: 8 Feb 2006
Posts: 124
|
07-12-2007 18:34
Are we forgetting about llRotLookAt or llLookAt? llRotLookAt(rotation target, float strength, float damping) llLookAt(vector target, float strength, float damping) refer to wiki for more details
|
|
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
|
07-12-2007 19:06
eyeball attachment is no good solition either so i won't suggest that.
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
|
|
Kurzweil Sleeper
Registered User
Join date: 4 Jan 2006
Posts: 12
|
llGroundRepel() or llSetBuoyancy()
07-12-2007 23:43
Either of those might work on attached objects. us a llSin function to get the bobbing effect. This is all guesswork, as I am on a dinosaur machine that can't handle the SL client.
maybe [LSL] llGroundRepel(llSin(llGetUnixTime())+4.5,TRUE,1); [/LSL] would float between 4 and 5 m off the ground, depending on the sine of the time (that pun is a classic!)
|
|
Lila Pixie
Registered User
Join date: 7 Jun 2006
Posts: 20
|
07-13-2007 00:12
I have such a balloon for sale, its sculpted too  I have scripted my balloons uses physics to float away on touch instead of bobbing up and down. However, a friend asked me if it works as an attachment and out of curiosity I tried. Yup, it lifts my avie way up high into the sky! Strangel if you like, we can work together on this.
|
|
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
|
07-13-2007 00:27
From: Lila Pixie I have such a balloon for sale, its sculpted too  I have scripted my balloons uses physics to float away on touch instead of bobbing up and down. However, a friend asked me if it works as an attachment and out of curiosity I tried. Yup, it lifts my avie way up high into the sky! Strangel if you like, we can work together on this. Yeah, I wanted it to specifically bob and bounce rather than fly away, partially because I remembered seeing mention of yours and didn't want to infringe or anything, and largely just because I'm so tickled by the notion of wearing one.  So far, I've got the balloon to bounce and follow (as a pet-type object, not as a wearable), have it set to change colors on command, and have tried to produce a "string" effect with particles... only minimal success, there; the results are very choppy when the avatar moves. My next thought was to set the particles to target an object--a string "bracelet"--so that the string didn't drift into the crotch area like particles love to do, but that's going to involve transmitting the UUID to the particle object and the thought of all that makes my head ache. Would love to collaborate, 'cause at this point, I'm at a loss. *laugh* IM me in-world?
|
|
Lila Pixie
Registered User
Join date: 7 Jun 2006
Posts: 20
|
07-13-2007 06:15
Dagger's been asking me to create one that bobs too, so I've actually been working on it for a while. In fact, I have something that does sort of bob and bounce. Although, it currently doesn't behave well after collisions...
|
|
Zen Zeddmore
3dprinter Enthusiast
Join date: 31 Jul 2006
Posts: 604
|
07-13-2007 07:10
Particles? what's wrong with a flexie? The Red Balloon doesn't tether to the AV but hovers at a distance. Is there an "attachment springiness" value one can set? Note, i'd also think that the "pet follow" mode would work best ( but that probably gets borked in no scipt zones,eh?)
_____________________
A kilogram of programmable nanobots can lower the certainty of both death AND taxes.
|
|
Strangel Bade
Omnomnomnivore
Join date: 27 Apr 2007
Posts: 231
|
07-13-2007 12:25
From: Zen Zeddmore Particles? what's wrong with a flexie? The Red Balloon doesn't tether to the AV but hovers at a distance. Is there an "attachment springiness" value one can set? Note, i'd also think that the "pet follow" mode would work best ( but that probably gets borked in no scipt zones,eh?) Flexi was another thing I tried--the attachments turned out to be impossible to manage for this. Currently, I'm thinking I'll either set the "string" part as a child prim with different settings that tell it to face the wrist object (which will mean getting the wrist object's UUID sent to the balloon object and all that jazz--no idea how to do that bit yet) or... just wander around with it as-is and if anyone asks, reply: "You don't see the string? How odd! ...It must not be showing up on your client!"  Also, something I discovered about the scripts in the balloon currently--when I go above 300ft, the balloon doesn't follow, and if I rez a new copy at that height, it rezzes on the ground. Found a whole herd of pet-follow balloons congregating underneath my skybox, last night. That was interestin'.
|