Team Fortress 2 "push away" collision group?

COLLISION_GROUP_PUSHAWAY has no effect, does anybody know how to implement this?

[editline]3rd March 2015[/editline]

Ultimately, I want to make sure the player is never inside a certain nocollided prop.

You could use ShouldCollide or SetupMove to check for that collision group. If inside then ( from the center of the prop ) apply force from the normalized vector from the center of the prop to the center of the player or other prop. That’ll push them out of the prop in the direction of least depth…

If they cross over the center, then they’ll be pushed out the other side.

ShouldCollide is out of the question (or else this happens).

I can’t seem to see the video but I’m guessing vehicles falling through the world or physics breaking?

That happens if you constantly change collision type inside. If it is hard-set on something you’ll be fine.

I tried setting up a system for going invisible which would let me walk through props and it ended up being incredibly stable and I rarely had a crash. I changed it again and simplified it a bit so that if players are physgunned then they can go through doors, etc. I have yet to have a crash or have physics break.

Also, ShouldCollide is called when a player looks at something too, so keep that in mind.

Here’s what I did:


function GM:ShouldCollide( _e1, _e2 )
	// Allow Physgunned players to be pulled through objects...
	if ( ( _e1:IsPlayer( ) && ( ( _e1:IsAdmin( ) && _e1:Invisible( ) ) || _e1:GetMoveType( ) == MOVETYPE_NOCLIP ) ) && ( _e2:IsNPC( ) || _e2:IsDoor( ) || _e2:IsVehicle( ) || _e2:IsProp( ) ) ) then
		return false;
	end
end

Basically, no collide if a player is in no-clip ( should happen anyway, right?? But it doesn’t work that way ) so on physgun pickup by admin ( different system ) they’re frozen and put into noclip. Helps out quite a bit. It also allows it if the player is admin and invisible ( IsAdmin is only true when in admin mode which can be toggled or bound to character ) and it only allows it through certain types of entities. Vehicles, Doors, NPCs, and props ( I should actually allow players too ).

The IsAdmin or Invisible portion is the most likely to cause an issue portion of it.

But, yes, should-collide is the wrong place to apply forces; use SetupMove. ShouldCollide, however, is where you’d disable collision if something is that collision group ( unless it is already handled, which it should be ).

https://a.pomf.se/dsuawo.mp4

Thanks! Is there any way I can get prediction working so it doesn’t feel sluggish?

The Should Physgun Pickup hook is shared so if it is in a shared file then you’ll have a smooth and straight phys-beam. If you need to use a server call ( ie isolating one of the returns to server only such as vehicle GetDriver / GetPassenger ) then you’ll have that “lag” / bendy-beam.

If that’s what you mean.

Also, walking through a prop, you’ll need to make sure the function is shared. What is happening is the client things that it is a solid prop but the server says it isn’t. That’s where that motion comes from. It’s also how I know that vehicle motion is 100% controlled by server ( I recompiled models in a map to make the trees solid; vehicles stopped going through and didn’t jitter but the client did until I had the new models on the client as well )…

As long as everything is shared, you should have no issue.