Skip to content

Optimize UTIL_CreateScaledPhysObject#1880

Open
RaphaelIT7 wants to merge 2 commits intoValveSoftware:masterfrom
RaphaelIT7:patch-2
Open

Optimize UTIL_CreateScaledPhysObject#1880
RaphaelIT7 wants to merge 2 commits intoValveSoftware:masterfrom
RaphaelIT7:patch-2

Conversation

@RaphaelIT7
Copy link
Copy Markdown

Description

I made this back in like 2024, though it should be merged upstream for everyone's benefit :)
This optimizes UTIL_CreateScaledPhysObject by switching it to use CPhysPolysoup which is way faster.
I've suggested this change for GMod around a week ago and has been working great there on the dev branch.

This is an old performance test from when I made it since I can't test it with the sdk when the engine keeps crashing :/
Though even in GMod it was confirmed to be significantly faster.
image

Test with the same 100 PhysCollide:
Old took ~880ms
New takes ~140ms

@PiMoNFeeD
Copy link
Copy Markdown

PiMoNFeeD commented Apr 18, 2026

ConvertPolysoupToCollide's 2nd argument should be false instead, because ConvertConvexToCollide does not use MOPP. Also, pretty sure MOPP path isn't even compiled in the binary?
Having it "true" instead technically works for regular VPhysics (because its unused, looking at decomp), but breaks VPhysics Jolt which doesn't implement it and returns NULL instead for that path

Thanks :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants