TheNexusAvenger / Nexus-VR-Character-Model

Maps Roblox characters to the VR inputs of players.
MIT License
67 stars 12 forks source link

Ability to add Ray Ignores to FindCollidablePartOnRay #38

Closed karl-police closed 9 months ago

karl-police commented 10 months ago

About https://github.com/TheNexusAvenger/Nexus-VR-Character-Model/pull/36

FindCollidablePartOnRay, doesn't ignore CanCollide if CanQuery is on.

In many cases, complex stuff all stacked into each other, lags everyone else, because of it. But it's game specific.

But there's nothing one can do other than forced to modify the Modules, right now.

karl-police commented 10 months ago

@TheNexusAvenger any other ideas, if no API 🤷

TheNexusAvenger commented 10 months ago

Either an API should be added, or FindCollidablePartOnRay should be updated to handle your case that does not involve interacting with Nexus VR Character Model at all. An explanation of your use case would help.

karl-police commented 10 months ago

Either an API should be added, or FindCollidablePartOnRay should be updated to handle your case that does not involve interacting with Nexus VR Character Model at all. An explanation of your use case would help.

A bunch of parts that are stacked and gathered around eachother

They need CanQuery on true but have CanCollide on false

If a VR player "walks" under those, every player starts lagging because of the Rays.

Solution would be to allow customization of adding things to ray ignore 🤷

TheNexusAvenger commented 10 months ago

A performance problem I've known about is the constant re-building of the ignore list with each recursive call. Maybe try a fork with a version of FindCollidablePartOnRay that re-uses the ignore list with each recursive call? That would help a lot more games.

karl-police commented 10 months ago

A performance problem I've known about is the constant re-building of the ignore list with each recursive call. Maybe try a fork with a version of FindCollidablePartOnRay that re-uses the ignore list with each recursive call? That would help a lot more games.

hmmm a API to add things to a "global Ray Ignore list" that would get re-used?

TheNexusAvenger commented 10 months ago

This is what I meant: https://github.com/TheNexusAvenger/Nexus-VR-Character-Model/blob/6d70249f5c5467fdfe4968dea37dd28a23b5baab/src/Util/FindCollidablePartOnRay.lua#L24-L33

Every recursive call creates a table and copies all the entries of the table from the previous reversal call. For 100 stacked uncollidable parts, this would be creating and copying 100 tables every frame. I'd like to see if a general solution, like solving that, is attempted before creating a new API.

karl-police commented 10 months ago

This is what I meant:

https://github.com/TheNexusAvenger/Nexus-VR-Character-Model/blob/6d70249f5c5467fdfe4968dea37dd28a23b5baab/src/Util/FindCollidablePartOnRay.lua#L24-L33

Every recursive call creates a table and copies all the entries of the table from the previous reversal call. For 100 stacked uncollidable parts, this would be creating and copying 100 tables every frame. I'd like to see if a general solution, like solving that, is attempted before creating a new API.

to have only one table?

The FootPlanter puts the centerpart's parent and the character inside there

Arc puts the humanoidrootpart in there

so different things to ignore, clearing out the entire table list, idk if it makes sense, but then you'd just have one table

uhhhhh... less for gc to collect but 🤷

karl-police commented 10 months ago

Well, FindCollidablePartOnRay can actually be replaced, just by replacing the ModuleScript. But yeah 🤷

This is not a problem. So, if there are a bunch of stacked parts and they use the Default CollisionGroup. Then it's not NexusVR's fault. It's the dev's.

They shouldn't be using the Default CollisionGroup, because it's the standard one for Raycasts. It would also lag the default Roblox Camera. Therefore this doesn't really have to be fixed.

But I am not sure if FilterDescendants is actually better, regardless of whether the CollisionGroup is Raycast'able or not.