#Why is Unity still building a Physics World, when I have Set Physics to "No Physics"?

1 messages · Page 1 of 1 (latest)

cunning urchin
#

See image for explanation.

slim carbon
#

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

cunning urchin
#

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?

cunning urchin
#

also what did you mean by turning off jobs debugging, did you mean this?

slim carbon
#

jobs debugger is what detects and gives you those errors about scheduling etc in editor

#

that said, 300,000 physics objects is a lot

cunning urchin
#

so many new checkboxes to learn

slim carbon
#

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

cunning urchin
#

yeah, a co-worker of mine assumes it is because Unity Physics is stateless and needs to rebuild the tree every frame

slim carbon
#

it does

cunning urchin
#

i never really researched what that all means myself

slim carbon
#

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

cunning urchin
#

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

hexed shore
slim carbon
#
            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);```