Orabelle Posted May 26, 2015 Share Posted May 26, 2015 Is it possible to throw/toss object that are worn? Or something to that extent anyways. I've seen those 'gun' scripts and whatnot that 'fire' copies of inventory objects, but what I'm looking for is something that moves the original. Like, for example you have a ball in hand and you want to toss it a short distance. How would I go about doing that?Second question - assuming the above is possible, would you be able to start another script the moment said object is thrown? I'm not sure what all is possible. Maybe the first part would detach said object and move it to the world, and that would be the starting factor? I dunno, just a thought. I'm a newbie, help me out. X3 Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted May 26, 2015 Share Posted May 26, 2015 You can't throw a thing you're wearing, as the "detach" operation puts it back into inventory (well, it never really left inventory, but it ceases to exist in-world). And if you could throw an attachment, you'd have to hunt it down to take it back after the throw, or hope that auto return puts it into your lost-and-found folder. That's why throwers rez temporary objects to toss. They vanish after a minute, so there's no housekeeping. If you want to make it look like you've tossed the thing you're holding, you'd make it invisible the moment the toss occurs. Anyone paying close attention would catch the deceit, but it's good enough for most. By placing a script in the thing being tossed, you effectively start another script at the rezzing/tossing moment. That script is in the tossed thing, of course, and I think that is your intention. Link to comment Share on other sites More sharing options...
Orabelle Posted May 26, 2015 Author Share Posted May 26, 2015 Thanks for your reply. That clears up that. I'm thinking maybe instead of turning the object invisible, I could just detach/delete the worn object at the end of the animation, so it wouldn't be there at all. You think that would work well? It's something I could definitely work with, now that I think about it. Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted May 26, 2015 Share Posted May 26, 2015 Yes, you can detach at the instant of throwing. That limits you to one throw per wearing, of course. Once I start throwing things, I find it hard to stop. ;-). Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 26, 2015 Share Posted May 26, 2015 It's all in the timing. I assume that the "throwing" script and anim will be in the object that is attached to your hand. Therefore, you can't detach the object until after the script has done its job. It's almost inevitable, then, that you'll want to make the object transparent slightly before you detach it. The logic then will be something like Owner touches a HUD button to trigger the throw (or maybe uses a mouse click in mouselook to get a target location -- llCastRay probably -- and send it to the object) HUD signals the object, sending whatever targetting information is necessary Object triggers a throwing anim for the owner. Object rezzes a physical copy of itself, giving it the target and an initial velocity Object goes transparent. New thrown object speeds on its way Attached object stops anim and then detaches. Thrown object -- temp rezzed or with a timed llDie -- vanishes. You'll have to mess with timing a lot to make it look right. It will never be perfect, because the anims are played client side and region lag may screw up your timing. Still, it should be fun. EDIT: For a very simple version of this idea, you might want to take a look at any of the popular full-perm snowball throwers that are floating around in SL. Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted May 26, 2015 Share Posted May 26, 2015 Regarding llDie(), you can use that to vaporize a rezzed temp object before the timeout, but you'll still want to make the object temp or risk having to recover it in no-script areas. I learned that (and how to find things) the hard way. ETA: I suppose this isn't an issue if the throwing script can't run to throw the object in the first place. Oops! ETA2: Though if you waltz into a no-script area with the attachment already on, you'll need the safety of a temp object. Can you tell I've been posting before thinking this through? Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 26, 2015 Share Posted May 26, 2015 Quite true. I should have made it clear that the object should be scripted for both temp_on_rez and llDie. It's a race to see which one kills the object first, but temp_on_rez is the backup default. Link to comment Share on other sites More sharing options...
Orabelle Posted May 26, 2015 Author Share Posted May 26, 2015 Yeah, I have a feeling the timing will be a huge pain to work with. Haha. It's just a fun little project I'm working on though, so it won't have to be too perfect, thankfully. Thanks for your input, it's really helpful. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 27, 2015 Share Posted May 27, 2015 Since animations are rendered client-side, no two people are ever going to see quite the same thing at the same time when an animation plays. So much depends on internet connections, computer hardware and so on. So don't sweat your synchronisation too much. However, it strikes me that you can probably simplify your life a lot by having two animations -- one to draw your arm back, preparatory to throwing, and a second actually to throw the ball. So, assuming you know how long the first animation (prepare to throw) takes, you can start a timer, and then when that fires, trigger the throwing anim, rez the temp-on-rez ball, and make the ball you're throwing invisible, all at the same time. Or you could maybe start the throwing action by holding down the left mouse button and then throw the ball by releasing it. Either way, I think I would use two separate animations to simplify things. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now