#Why is Unity still building a Physics World, when I have Set Physics to "No Physics"?
1 messages · Page 1 of 1 (latest)
That doesn't mean no physics
That means no simulation
It will still build a BVH so you can query colliders etc, it just won't run any simulation on them
It's extremely useful if you don't care about simulating dynamic objects but want to have a powerful tree to query objects in world via raycasts, overlaps etc
On a side note, your performance seems shocking I would suggest you make sure you don't have integrity checks on
and for the sake of profiling, making look at turning off jobs debugging temporarily
I'm spawning about 300,000 entities with static physics shapes over a very wide area, and 160 dynamic physics shape entities that all fire dynamic physics shape projectiles as a stress test
but as you said, the integrity checks were on.
what do those do exactly?
also what did you mean by turning off jobs debugging, did you mean this?
jobs debugger is what detects and gives you those errors about scheduling etc in editor
that said, 300,000 physics objects is a lot
so many new checkboxes to learn
from my experience it starts falling apart about 40k+
but maybe that was 40k dynamic
i don't recall stress testing statics, i probably should
yeah, a co-worker of mine assumes it is because Unity Physics is stateless and needs to rebuild the tree every frame
it does
i never really researched what that all means myself
in theory it should be able to not rebuild statics unless you add/remove one
but i think there is a bit of an issue with that atm
that is what we were hoping would happen, as we plan to have lots of static that don't change much (but can), and far less dynamic
I guess up until now still dun have something called incremental BVH?
They simply have different trees for static and dynamics
internal struct Broadphase : IDisposable
{
[NoAlias]
private Tree m_StaticTree; // The tree of static rigid bodies
[NoAlias]
private Tree m_DynamicTree; // The tree of dynamic rigid bodies```
haveStaticBodiesChanged.Value = 0;
{
if (world.NumStaticBodies != previousStaticBodyCount)
{
haveStaticBodiesChanged.Value = 1;
}
else
{
staticBodiesCheckHandle = new Jobs.CheckStaticBodyChangesJob
{
LocalToWorldType = componentHandles.LocalToWorldType,
ParentType = componentHandles.ParentType,
#if !ENABLE_TRANSFORM_V1
LocalTransformType = componentHandles.LocalTransformType,
#else
PositionType = componentHandles.PositionType,
RotationType = componentHandles.RotationType,
ScaleType = componentHandles.ScaleType,
#endif
PhysicsColliderType = componentHandles.PhysicsColliderType,
m_LastSystemVersion = lastSystemVersion,
Result = haveStaticBodiesChanged
}.ScheduleParallel(staticEntityQuery, inputDep);
}
}```
and they have checks for static body changes
it's been a while since I looked at it, but if I recall this triggers much more than is intended
it's also based on change filters so most users just wildly open these up
triggering a rebuild without realizing
bool didBatchChange =
chunk.DidChange(ref LocalToWorldType, m_LastSystemVersion) ||
chunk.DidChange(ref LocalTransformType, m_LastSystemVersion) ||
chunk.DidChange(ref PhysicsColliderType, m_LastSystemVersion) ||
chunk.DidOrderChange(m_LastSystemVersion);```