Jump to content

Bullets won't move


Aaleyah Lovell
 Share

You are about to reply to a thread that has been inactive for 4569 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello, pretty simple problem that I can not figure out! The gun when in mouselook will rez the bullet but the bullet just floats at the rez point and does not move... I used the code from the second life wiki and it did the same thing as my code below...

 

float SPEED = 100.0; 
integer LIFETIME = 7; 
float DELAY = 0.2; 
vector vel; 
vector pos; 
rotation rot; 
integer have_permissions = FALSE; 
integer armed = TRUE;
string bulletName = "bullet 1.0";
fire()
{
if (armed)
{
armed = FALSE;
rot = llGetRot(); 
vel = llRot2Fwd(rot); 
pos = llGetPos(); 
pos = pos + vel; 
pos.z += 0.75; 

vel = vel * SPEED; 

llTriggerSound("Zapper Noise", 1.0); 
llRezObject(bulletName, pos, vel, rot, LIFETIME); 

llSetTimerEvent(DELAY); 
}
}
default
{
state_entry()
{
if (!have_permissions) 
{
llRequestPermissions(llGetOwner(), 
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS); 
}
}
on_rez(integer param)
{
llPreloadSound("Zapper Noise"); 
}
run_time_permissions(integer permissions)
{
if (permissions == PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS)
{
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
llStartAnimation("hold_R_handgun");
have_permissions = TRUE;
}
}
attach(key attachedAgent)
{ 
if (attachedAgent != NULL_KEY) 
{
llRequestPermissions(llGetOwner(), 
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS); 
}
else
{
if (have_permissions)
{
llStopAnimation("hold_R_handgun");
llStopAnimation("aim_R_handgun");
llReleaseControls();
llSetRot(<0,0,0,1>);
have_permissions = FALSE;
}
}
}
control(key name, integer levels, integer edges) 
{
if ( ((edges & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON)
&&((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) )
{
fire();
}
}

timer()
{
llSetTimerEvent(0.0);
armed = TRUE;
}

}

 

 

Link to comment
Share on other sites

That is a typical case of bullets without physics.

Go to Edit mode.

Rez the bullet on the ground. Do not release it!

Set it to PHYSICAL and TEMPORARY. (Do not forget temporary or you will see bullets returned to you by land owners for a week or more...)

Take it quickly!

Replace the bullet in the gun. Done!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4569 days.

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
 Share

×
×
  • Create New...