|
Zammy Voom
Registered User
Join date: 7 May 2007
Posts: 33
|
06-02-2007 20:53
hey there everyone! im very new to Second Life, and im loving it! the concept that you can create anything your heart desires is amazing to me.
i've got the basics of building, and i've looked at a few basic scripting tutorials, and i got the gist of them.
there's one thing im really stuck on though. by the look of the way weapons in SL work, i don't think what im after is possible, but i really hope so, so i thought i'd give it a shot asking for help here.
im trying to make my avi throw a ball. the animation isn't a problem (apart from making it lol, it will be an ugly task but its do-able), its more the scripting side of it.
i am at a loss for how to rez an object directly in front of my avatar. my guess is i'll probably script an item attatched to me, method of activation is not important to me yet, but i learnt very quickly that llGetLocalPos() and llGetLocalRot() are useless when dealing with the avatar, or at least objects attatched to it. they work with objects with an in-world presence, but not when im wearing them.
i opened up the popgun script to see how that works. this gun, and a couple of others i've seen require you to be in mouselook, for which llGetPos() and llGetRot() work. i don't want to be in 1st person, i want, or should i say need to be in 3rd.
can anybody help me with a way to make llRezObject() work in 3rd person?
|
|
Bree Giffen
♥♣♦♠ Furrtune Hunter ♠♦♣♥
Join date: 22 Jun 2006
Posts: 2,715
|
06-02-2007 22:24
I made a bead necklace thrower. It throws from third person too. I will send you copy to look at.
|
|
Zammy Voom
Registered User
Join date: 7 May 2007
Posts: 33
|
06-03-2007 00:05
From: Bree Giffen I made a bead necklace thrower. It throws from third person too. I will send you copy to look at. thanks a lot! will be sure to take a look at it 
|
|
Ryken Redgrave
Registered User
Join date: 26 Dec 2006
Posts: 13
|
08-08-2007 16:46
From: Bree Giffen I made a bead necklace thrower. It throws from third person too. I will send you copy to look at. Any chance I could take a look at that as well? 
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
08-09-2007 10:07
You were on the right track with the popgun, the only command you should be worrying about is llRezObject right now. Create a box, attach it to your hand or leave it on the ground, and have it do something like the following (eventually replacing the touch event with your controls and mouse button etc or even a chat command). Put any object in the object contents called 'bullet'. integer DIST = 1; string gBulletName = "bullet"; float gBulletSpeed = 0; integer gBulletDamage = 0; // Passed to the bullet script via the rez param default { touch_start(integer total_number) { llSay(0,"Let the shoostings begin!"  ; //this will get the rotation of the prim, or your avatar if attached rotation rot = llGetRot(); //gets a unit vector rotated to that rotation vector aim = llRot2Fwd(rot); // gets your (or the rez'd object's) position plus a DIST meter offset in // the aim direction vector pos = llGetPos() + (aim*DIST); // rezzes an object called "bullet" at location <pos> // moving at gBulletSpeed in the direction of aim // rotated to face the rotation <rot> // and doing 0 damage on contact with an avatar llRezObject(gBulletName, pos, aim * gBulletSpeed, rot, gBulletDamage); } }
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
08-09-2007 10:12
after that you can fancy up your box to look like some sort of thrower, or make it invisible if you like, add controls to use left button, or mouselook or whatever you like to trigger the functionality, set some velocity etc and probably make the ball physical so that it flies in an arc determined by gravity. These are all separate tasks that you should be able to tackle one at a time, each having its own set of headaches I'm sure 
|