View Single Post
Author Message
foon
Member
Join Date: Dec 2018
Old 10-18-2019 , 12:31   [tf2] hook when physics objects collide?
Reply With Quote #1

Im wondering if there is a way to test when a physics object (pipebomb, stickybomb, milk, jarate, etc [it does work with all flairs, but not gaspasser]) hits another?

I am spawning in a model and setting the solidtype to vphysics, It triggers with rockets fine, but no physics objects. I have tried all collision groups, but none work. Any ideas?

Code:
}
int entity = CreateEntityByName("prop_physics_override");
	if (IsValidEntity(entity))
	{
		SetEntityModel(entity, model);
		DispatchKeyValue(entity, "StartDisabled", "false");
		DispatchSpawn(entity);
		
		TeleportEntity(entity, origin, NULL_VECTOR, NULL_VECTOR);
		
		SetEntProp(entity, Prop_Send, "m_usSolidFlags", 12); // FSOLID_NOT_SOLID|FSOLID_TRIGGER
		SetEntProp(entity, Prop_Data, "m_nSolidType", 6); // SOLID_VPHYSICS
		SetEntProp(entity, Prop_Send, "m_CollisionGroup", 2); // COLLISION_GROUP_DEBRIS
		AcceptEntityInput(entity, "Enable");
		
		SDKHook(entity, SDKHook_StartTouch, Hook_OnTouch);
	}
}

public Action Hook_OnTouch(int call, int client)
{
	PrintToServer("touched");
}

Last edited by foon; 10-18-2019 at 14:19.
foon is offline