|
|
#1 |
|
Guest
Posts: n/a
|
Ragdolls
I have various questions regarding ragdolls. I'm working with the HL2DM mod base. I was originally looking into making ragdoll pickups with the gravity gun (similar to the end of HL2 Single Player). After some testing with server side ragdolls (and the network traffic that they create), I decided this wasn't really a practical idea. I've come up with an alternative solution.
Right now, I'm trying to check when a living player is standing over a corpse/ragdoll. Here's some simple test code: Code:
trace_t trace;
UTIL_TraceEntity( this, GetAbsOrigin(), GetAbsOrigin() - Vector(0,0,256), MASK_ALL, &trace );
if( trace.m_pEnt && trace.m_pEnt->GetBaseAnimating() && trace.m_pEnt->GetBaseAnimating()->IsRagdoll() ) Msg("Is a ragdoll");
A) Detecting when a player was standing over a ragdoll B) If it was possible to link the ragdoll with a player (i.e: which player created that particular ragdoll). Finally, to be able to do the above checks, would it be necessary to create server-side ragdolls? |
|
|
|
#2 |
|
Guest
Posts: n/a
|
A) look at the Use() function (or any other it uses, maybe FindUseEnt()). It checks whether the entity you try to pick up is GetGroundEnt() or something similar (don't remember)
B) simply add a variable, add it as a field to the ragdoll's class and fill it upon creation (you want to look at CreateServerSideRagdoll() or CBaseSomething::BecomeRagdoll()... it's somewhere in CAI_BaseNPC) when I check if tr.m_pEnt is a ragdoll I just do if( FClassnameIs(tr.m_pEnt, "prop_ragdoll") ) or if( dynamic_cast<CRagdollProp*>(tr.m_pEnt) ) hope this helps |
|
|
|
#3 |
|
Guest
Posts: n/a
|
I also wanted to know if it was possible to 'freeze' a server-side ragdoll. So that after its initial reaction to the force that caused the players death, it would freeze and essentially become a static prop?
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
theRagdoll->VPhysicsGetObject()->SetMotionEnabled(false); //should help
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
I'm really looking to be able to manipulate ragdolls via the physgun, but I'm not having much luck. From my investigation, someone suggested adjusting the flags that ObjectCaps returns. But I'm not entirely certain what ObjectCaps actually signifies.
|
|
|
|
#6 |
|
Guest
Posts: n/a
|
The ObjectCaps method can be used to set a entity to 'useable' or not.
A piece of sample code: Code:
//-----------------------------------------------------------------------------
// Purpose: Returns ObjectCaps() with possibility of using the Victim
//-----------------------------------------------------------------------------
int CVictim::ObjectCaps( void )
{
int caps = BaseClass::ObjectCaps();
return caps |= FCAP_ONOFF_USE;
}
FindUseEntity() in (I thought) Player.cpp traces a line from the player's viewpoint forward and checks if entities colliding with that line are useable. It will check for these ObjectCaps... Hopes this helps! ![]() Edit: By the way, can't you just check the code of the superduper physicsgun from HL2? Last edited by Penumbra: 07-02-2007 at 11:50 AM. |
|
|
|
#7 | |
|
Guest
Posts: n/a
|
Quote:
Bullets also pass straight through them. |
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|