Talk:Prop physics override

From Valve Developer Community
Jump to: navigation, search

Question for anyone who knows: Is it possible to create a prop_physics_override entity in a multiplayer game with a npc model (i.e. "models/alyx.mdl") and make the new entity able to be picked up and moved by the phys gun? I've got the entity to spawn with alyx's model but cannot figure out how to make it effected by the phys gun. Thanks.

Did you try the Enable motion on Physcannon grab flag?- RodeoClown 21:24, 27 Apr 2006 (PDT)

You should check out how the mattress from hl2 can be picked up...it's for sure a prop_ragdoll...mdldecompiler to see how the mattress is defined—ts2do 21:30, 27 Apr 2006 (PDT)

Rodeoclown: Yes, I tried that with no success. Ts2do: I will check into the mattress. Here's a hack that seems to work:

CPhysicsProp *toAdd = assert_cast<CPhysicsProp*>(CreateEntityByName( "prop_physics_override" ));
toAdd->SetAbsOrigin( Vector(0, -200, -1000) );
toAdd->SetAbsAngles(QAngle(0,0,0));
toAdd->SetAbsVelocity(Vector(0,0,0));
const char* modelName = "models/items/item_item_crate.mdl";
toAdd->PrecacheModel(modelName);
toAdd->SetModel(modelName);
toAdd->Spawn();
toAdd->SetModel("models/alyx.mdl");
toAdd->SetMoveType( MOVETYPE_VPHYSICS );
toAdd->SetSolid(SOLID_BBOX);
toAdd->AddSolidFlags( FSOLID_NOT_STANDABLE );
toAdd->RemoveEFlags(EFL_NO_PHYSCANNON_INTERACTION); //not sure if needed
toAdd->RemoveEFlags(EFL_NO_GAME_PHYSICS_SIMULATION); //not sure if needed
toAdd->RemoveEFlags(EFL_NO_MEGAPHYSCANNON_RAGDOLL); //not sure if needed

So basically you spawn an entity that is effected by the phys-gun, then change the model afterwards. I'm interested in finding the proper way to do this, so hopefully what I've got here can serve as a base to getting a non-hackish implementation. Thanks for the help. - Daktor 5:26, 29 Apr 2006 (PDT)

I am more than one year late but if it doesn't want to pick it up, that's because of the flesh material of Alyx's body.--Hurricaaane 09:13, 9 Dec 2007 (PST)