|
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
|
01-27-2007 16:32
I need to make a script for an object that is held in hand (worn) and then tossed, like a ball. Accuracy is not important; it needs to go in the general direction but that's all (with a nice arc, like a short lob).
What approach would you take: detach from the hand, apply impulse? Or rez an object like a bullet, and disappear in hand?
Ideally, there would be an associated animation for the toss, but this is not crucial. If so, aiming (figuring out the rotation) could be tricky, as well as the timing.
Any other suggestions would be appreciated. This would be my first script using physics, but I'm reasonably well versed in attachments, starting animations, handling events, and menus. I'm also an experienced pro programmer so I know the lingo.
Thanks! Jeff
|
|
JoeTheCatboy Freelunch
Registered User
Join date: 14 Jun 2006
Posts: 42
|
01-27-2007 20:52
here's how it would work best.
on CONTROL_ML_LBUTTON & level & edge rez a ball with a small speed (llGetRot() * <1,0,0> * 30) or so Set the alpha of the ball in hand to 0.0
wait for a bit... maybe play a "reload" animation, then set alpha back to 1.0
|
|
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
|
01-28-2007 09:44
Thanks, Joe. I ended up using the example gun in the LSL Wiki, modifying it for my purposes, inluding just unattaching after rezzing the 'bullet'. The 'bullet' looks just like the object in hand, and contains another 'bullet' for whoever it collides with or touches it to accept in inventory (the catch), after which it kills itself. Not good enough for baseball, but good enough for my purposes.
Not really even good enough for a game of catch -- if there is a way to do that it would be interesting to learn, but so far I don't see any way (without way too much menu interaction).
Thanks again Jeff
|