Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Grav guns... what the hell do they do?

Dagmar Strauss
Registered User
Join date: 21 Dec 2005
Posts: 17
01-06-2006 11:00
I'm not asking for a script or nuthin', but i've been reading the wikki for a few days and watching shit in transp mode, and I can't figure out what the heck grav guns (or "force powers", or whatever people use to drag folks around in ML) do.

Is it like really, REALLY well-controlled push? I doubt it. Would anyone care to explain the concept to me?
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-06-2006 11:52
Just like the grav gun in half-life.
In other words, yes, it's like a controlled push. It allows one to "pull" a physical object towards the gun with artificial gravity.
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
01-06-2006 11:53
I remember one time, when Adam Zaius, Oz Spade, I, and some more Resis went on a fun "LindenNappers" trip. Had a grav gun in tow, managed to beam us in some Lindens. :)
_____________________
Dagmar Strauss
Registered User
Join date: 21 Dec 2005
Posts: 17
01-07-2006 07:18
the thing that i'm talking about... like the black mesa grav gun or the force elements - doesn't pull things towards it so much as allow you go chuck an avatar back and forth in ML. I think the movement is too controlled to just be carefully managed push.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
01-07-2006 09:58
There are several grav guns out there, but I think they all may be related to the same one or two different codebases. The one I have works using carefully controlled pushes. It's really hard on the sim, but basically, the gun constantly looks at the target's position, calculates a push designed to move the target to a position floating in front of the avatar, and applies the push. This means that every time the target starts to fall due to gravity, the gun "corrects" their position, and every time the avatar moves their mouselook crosshairs, the target gets a corresponding nudge. We're talking 5-10 pushes a second here.

My friend and I (well, ok, mostly my friend) rewrote a gravgun we found because it was full of hacky, unnecessary, and unreadable code. It all boiled down to the very simple principle I explained above, with a very few extra "correctional" bits in there because SL physics aren't the world's cleanest. The key is in understanding that llPushObject will fall off with the cube of the distance from the pusher to the pushee -- so you need to multiply by the cube of the difference to compensate. There's also a falloff based on mass, so you need to factor in the target's mass... etc.

Anyway, there's no magic, no secret gravgun API in LSL... just lots of careful pushes :) The explanation above may explain how sometimes some gravguns get stuck yoyoing the target back and forth, because they're constantly correcting and get into a loop of sorts.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
01-07-2006 10:01
I suppose here is as good a place to ask as any, but the inverse cube rule for pushobject... what is the proportion there exactly? Only I've tried to do a few things with bouncing objects, and simply multiplying the impulse by llPow(llVecMag(pos1 - pos2), 3) doesn't work properly - close-up, the push is too great, further away it's too small.
AcidRaven Harrington
Linux User
Join date: 18 Jun 2005
Posts: 86
01-07-2006 19:20
What about captureing a person in a Physical/transparent object and moveing the object around. I think that is how one of my weapons that drags people to me works (it is a fan).
Just an idea
_____________________
Acidraven Harrington
Child Avatar
Height detector 1.0.4: AcidRaven Harrington is 1.191803 m
(3 feet 11 inches) tall. (counting your shoes)

Yo, ho, haul together,
hoist the Colors high…
Heave ho, thieves and beggars,
never say we die.
Freedom is for Everyone.
http://www.gopetition.com/petitions/full-reign-of-self-expression-for-consenting-adults-in-second-life.html
Jher Quartermass
Registered User
Join date: 24 Sep 2004
Posts: 18
recent work
01-07-2006 19:37
Oddly enough, I've been rewriting the same crappy gravity gun code that Lex Neva was talking about. His sounds a bit more tweaked than mine but if you want to pick up a copy of my variation, talk to simmy amos. He's my "pusher".

(oh and an "as of yet unrelased version" of my code can move 300,000 kg of mass (30 10x10x10 solid square prims) over my head in a moderately loaded server....)