StrataSource / Portal-2-Community-Edition

Task tracker for Portal 2: Community Edition
https://www.portal2communityedition.com
146 stars 3 forks source link

NPC entities passing through portals. Idea on how to fix it. #1552

Open Garmezon opened 8 months ago

Garmezon commented 8 months ago

Which component should be improved?

Entity

Describe your suggestion

I recently made an cool discovery: I've found a way to make NPCs potentially compatible with portals, and possibly even ragdolls as well. This discovery hinges on the fundamental mechanics of how portals function: they temporarily disable the collision properties of surfaces, allowing players and physics objects to pass through them. ( If not that i believe it works in a similar way)

I've come to the realization that the reason NPCs and ragdolls do not interact with portals is because they collide with portal walls instead of passing through them. I confirmed this hypothesis by experimenting with a Combine NPC and exluding its class from colliding with a func brush. The results indicate that portals work with npcs, as demonstrated in the video included with this request.

I propose that this functionality be integrated into the engine. Specifically, I suggest modifying the engine to disable the collision between NPCs and ragdolls and the surface of the portal when they are within a portal environment. Hope this is isn't too hard

https://github.com/StrataSource/Portal-2-Community-Edition/assets/147774718/427400d4-f2cc-4bdd-a553-265e1ca3467a

MyGamepedia commented 8 months ago

Duplicate of https://github.com/StrataSource/Portal-2-Community-Edition/issues/869.

MyGamepedia commented 8 months ago

And yeah, portals teleport anything with this feature, but not everything can fall through walls because of the filters and some code.

vrad-exe commented 8 months ago

This issue is better IMO since it has a video, I'll close my old one

vrad-exe commented 8 months ago

There is still the case to handle of NPCs going through portals in different orientations (e.g. coming out of a floor portal), do you know how that behaves?

MyGamepedia commented 8 months ago

There is still the case to handle of NPCs going through portals in different orientations (e.g. coming out of a floor portal), do you know how that behaves?

https://github.com/StrataSource/Portal-2-Community-Edition/issues/1441

MyGamepedia commented 8 months ago

1441

I'm pretty sure that it is not something very hard (we already have the code for players), however priorities make themselves felt.

vrad-exe commented 8 months ago

I was asking the author of this issue to test it

MyGamepedia commented 8 months ago

It's fine only if both portals are vertical portals or if both portals are horizontal. Otherwise or don't teleport at all or cause the issue (my old video from dead mod).

https://github.com/StrataSource/Portal-2-Community-Edition/assets/103366204/f731abad-5239-4071-a079-7173ac778bf9