Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Recoil

Rogo Gorky
Registered User
Join date: 9 May 2005
Posts: 39
06-26-2005 03:53
We have been working all day on a gun script.

It's perfect except for one thing. When shooting, my own avatar gets pushed backwards as the bullet is sent out. Yes, the bullet does have some mass, but is there a way that people have found to counteract recoil?
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
06-26-2005 04:02
From the wiki:

Recoil is applied to the rezzing object/avatar when it rezzes a physical object with a velocity. Large objects rezzed with a large amount of velocity will push with a large amount of force onto the rezzer, while a small object with small velocity will give negligable force (for every action there is an equal but opposite reaction). The formula for finding the force is as follows:

-(velocity of rezzed object * mass of rezzed object)

Use this in a llApplyImpulse statement to counteract the recoil.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Iron Perth
Registered User
Join date: 9 Mar 2005
Posts: 802
08-11-2005 14:27
This doesn't seem to work. I tried applying the impulse to the attachment before and after the rezzing of the object with the velocity vector.

Has anyone made this work?
_____________________
http://ironperth.com - Games for SecondLife and more.
Blain Candour
Registered User
Join date: 17 Jun 2005
Posts: 83
08-12-2005 06:01
I haven't tried either way but since rez has a small delay try making the rezzed bullet apply the impulse to the shooter on rez instead of the attachment applying it. Easier to detect the mass of the bullet on the fly that way anyway.