Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angled env_physics_blocker entities block hittables #267

Open
Derpduck opened this issue May 13, 2021 · 10 comments
Open

Angled env_physics_blocker entities block hittables #267

Derpduck opened this issue May 13, 2021 · 10 comments
Labels
Medium Priority Causing issues that happen every now and then and disrupt game flow. Verified Issue Confirmed/Reproduced

Comments

@Derpduck
Copy link
Contributor

Derpduck commented May 13, 2021

env_physics_blocker entities rotated by an angle will always block physics objects (hittables) regardless of the block type used, where the intended behaviour is for only block type 4 to block physics.

This means that any angled blocker that is supposed to only prevent exploits will interfere with hittables, and without fixing this bug the only solution would be to compromise on exploit blocks, or replace them with the obsolete env_player_blocker entity.

@SirPlease
Copy link
Owner

Do you know of a certain spot where this would be easy to test?

@Derpduck
Copy link
Contributor Author

This blocker by the forklit should be fine (on 2.0) https://i.imgur.com/18ig6Ji.jpg

@Derpduck
Copy link
Contributor Author

Here's a video to demonstrate this issue
https://youtu.be/q3ya0TUZEP0

@SirPlease
Copy link
Owner

Thank you for saving me the time, I'll test a fix tomorrow, promise.

@SirPlease SirPlease added Medium Priority Causing issues that happen every now and then and disrupt game flow. Verified Issue Confirmed/Reproduced labels May 17, 2021
@SirPlease
Copy link
Owner

I'm fairly this has to do with the fact that they're added by TLS, from what I've been able to test and try so far I haven't been able to modify its settings through a plugin.

@Derpduck
Copy link
Contributor Author

From what I know this issue has always existed, it just hasn't been noticed much before because angled clips were rarely used, but it affects all clips including those added by Stripper.
I don't think theres anything wrong with the settings of the clips themselves, they still correctly block the survivor/infected types they are set to block.

@Derpduck
Copy link
Contributor Author

Derpduck commented May 18, 2021

Did some testing and found a page that might point towards the reason for this bug https://developer.valvesoftware.com/wiki/CollisionProperty
It could be that physics props or the blockers themselves are set to have collision with env_physics_blocker entities by m_Collision or m_CollisionGroup net props in situations where it shouldn't collide.

Edit: Tested setting various collision related properties on physics props and blockers but hittables were still always blocked

m_CollisionGroup
m_Collision.m_nSolidType
m_Collision.m_usSolidFlags

@A1mDev
Copy link
Contributor

A1mDev commented Jun 18, 2021

Physical object (prop_physics) when approaching an angled env_physics_blocker entity just collides. It seems this should call the function 'CEnvPhysicsBlocker::ShouldCollide(CEnvPhysicsBlocker *this, int, int)', in it it is checked whether it can collide with this type of objects or not (depending on the set property 'BlockType'), but it doesn't happen. I think this is because the property m_nSolidType or m_usSolidFlags is different for the object angled env_physics_blocker entity, and this collides due to the fact that some conditions are the same in the code. I don't think it's good to change these properties. There is another option, the collisionhook (ShouldCollide) will handle this very well :D.

@jensewe
Copy link
Contributor

jensewe commented Oct 24, 2022

void CEnvPhysicsBlocker::Spawn()
{
	SetBlocksLOS(false);
	GetAbsOrigin();
	
	if ( m_nBlockType != 4 // All players and physics objects
		&& m_angAbsRotation != vec3_angle) // Not a null vector
	) {
		SetMoveType(MOVETYPE_NONE, MOVECOLLIDE_DEFAULT);
		SetCollisionGroup(COLLISION_GROUP_PLAYER_MOVEMENT);
		m_Collision.SetSolid(SOLID_BBOX); // an AABB
	}
	else
	{
		SetMoveType(MOVETYPE_VPHYSICS, MOVECOLLIDE_DEFAULT); // uses VPHYSICS for simulation
		m_Collision.SetCollisionBounds(m_vMins, m_vMaxs);
		m_Collision.SetSolid(SOLID_OBB); // an OBB (not implemented yet)
		VPhysicsInitStatic();
		m_Collision.SetSolid(SOLID_VPHYSICS); // solid vphysics object, get vcollide from the model and collide with that
	}
	
	SetBlocksLOS(false);
	SetBlockState();
}

Make sense for VPhysics_ShouldCollide helping in this scene given the above.

It's been over a year and there's always an easy fix via CollisionHooks according to @A1mDev though it's not working for Windows currently. However, a few questions in order for a possible way without noticeable consume:

  • Is there any alternative to avoid certain collision judging from above code?
  • Is it acceptable to use multiple blockers to simulate rotations?
  • Could we apply angles inputs to blocker afterwards and make it work as intended?

@A1mDev
Copy link
Contributor

A1mDev commented Oct 24, 2022

Yes, collisionhook is the worst option, but a working one, for those who do not want to delve into the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Priority Causing issues that happen every now and then and disrupt game flow. Verified Issue Confirmed/Reproduced
Projects
None yet
Development

No branches or pull requests

4 participants