This is a neat little bit of code that I'm using in a (yet unannounced) project that I am working on.
I thought I'd share the code because of the possibilities it opens up.
It's based on Linguica's gravity gun, but works vastly different, and the only real similarity is the math used, and even that is slightly changed.
Also, the object held will be affected by the player's pitch too.
Summon the class "pHealthBonus" and press use on it to pick it up.
Download:
Regular version
Multiplayer-compatible version*
* Work-in-progress, this should work exactly as the regular version does, except it should work online too. Currently untested online.
-TZK
[Code] Grabbable objects (a la Half-Life 2)
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
- LucasGodzilla
- Posts: 102
- Joined: Sun May 12, 2013 11:14 am
- Location: California
- Contact:
Re: [Code] Grabbable objects (a la Half-Life 2)
Huh, could be useful for picking up medkits into a demon battle.
Re: [Code] Grabbable objects (a la Half-Life 2)
It gets a little wonky around level geometry, but this is really cool. Certainly better than my bash at this kind of thing (think meleeattack with custom damagetype + A_Warp)
Last edited by amv2k9 on Wed Jul 10, 2013 6:33 pm, edited 1 time in total.
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
Re: [Code] Grabbable objects (a la Half-Life 2)
@LucasGodzilla
@amv2k9
-TZK
I can imagine someone making a mod that makes medkits grabbable, and then grabbing them at full health and hogging them all in a corner while they're surrounded.Huh, could be useful for picking up medkits into a demon battle.
@amv2k9
I guess the wonkiness around level geometry could be fixed with a few little workarounds. The method you mentioned could actually be combined with this to make it Zandronum compatible. The custom meleeattack would cause the actor to use a slightly-edited version of the script that causes the object to be held by the player.It gets a little wonky around level geometry, but this is really cool. Certainly better than my bash at this kind of thing (think meleeattack with custom damagetype + A_Orbit)
-TZK
- cortlong50
- Posts: 753
- Joined: Mon Jun 24, 2013 7:12 pm
- Location: UT-WA
Re: [Code] Grabbable objects (a la Half-Life 2)
can i use this? because picking up grenades and tossing them away from you would be awesome.
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
Re: [Code] Grabbable objects (a la Half-Life 2)
Of course! Why do you think I posted this in the resources forum?cortlong50 wrote:can i use this? because picking up grenades and tossing them away from you would be awesome.
-TZK
- cortlong50
- Posts: 753
- Joined: Mon Jun 24, 2013 7:12 pm
- Location: UT-WA
Re: [Code] Grabbable objects (a la Half-Life 2)
Hahaha thanks dude. Ive been messing with it and its awesome.