#SchnozzleCat2023 what s your physics
1 messages ยท Page 1 of 1 (latest)
Hi! Thanks for helping, I was just in the process of making a forum thread, but I'll pause that for now
For some reason all CollisionWorlds on my client and serer world are empty
The collision world on the default world has the entity that was converted in the loaded subscene
(and also another entry with Entity.Null in it for some reason)
This is reading from CollisionWorld.Bodies and CollisionWorld.NumBodies
The server and client entities have a physics shape, and a physics world index, but no physics body (as they are not simulated)
hmm, i haven't really looked at that, but what i have seen is that when i haven't correctly marked an object as a ghost with the owner being the server, and/or i haven't marked the system that creates it as "this is supposed to happen on the server", then i can have stuff mysteriously not appear
The thing is, all the components are there, it just seems like the BuildPhysicsWorld is somehow not processing them. It does however show a number of matching entities in the query
I'll post a few screenshots, give me a second
...interesting.
so to be clear, these are entities with no physics body, but which are supposed to be interpolated on the client? or predicted?
The character controller code runs in a prediction system
The client runs the same code for his own client that the server runs
This was the required approach before netcode added "true" physics support
It's a 2D game, so I don't really have any massive physics requirements in the first place
hmm, i never did this before that worked, so the way it worked for me is i just wrote the same code and the prediction handled it for me
i kind of doubt that's the issue here though?
Everything worked fine in 0.51, so I'm guessing something in the update broke
None of my collision queries on the client and server world work (since the collision world is empty that makes sense)
This is a subscene converted entity in the default world:
This is debugging code running in the default world:
The numbers are numBodies - numStaticBodies - numDynamicBodies
And the entity number matches the converted entity with the physics body:
So everything seems to be in order on the default world
now see i thought you were supposed to have a ghost component on there or something, let me look at my project
This is an entity on the server world:
But the num bodies returns 0 for the collision world on that world
The colliders are also correctly initialized, If I iterate over all physics colliders in the world they have correct values for radius, size, etc
but uh, i thought you weren't supposed to have bodies on any of them
Even if I add the same prefab that works on my default world to the subscene that is loaded in the server world, the collision world is still empty
so num bodies is supposed to be 0, no?
num bodies it the total amount of bodies, static and dynamic
a physics body makes the entity a dynamic part of the simulation
a physics shape just gives it a collider, but makes it static
See the message at the bottom
that's confusing. i thought a static body was different from a body-less shape
At least that's how it worked in 0.51, I couldn't find anything regarding changes.
And like I mentioned, it works fine in the default world, which is what makes this so strange
This is the entire authoring block for the entity I am testing with
default world yields numbodies = 2 with this in the world, server and client worlds yield 0
the BuildPhysicsWorld on the server is even matching entities
27 in this case
So I have no idea how the collision world ends up with 0
Also, maybe you know something about this, but the PredictedPhysicsConfig component is missing in 1.0.0-exp.8
It's mentioned here on the docs:
It says the singleton must exist on both the client and server, but that seems kind of hard if it doesn't exist ๐
my memory, and i suspect the netcode docs will bear this out, is that predicted ghosts have to be prefabs, and the prefab has to have a Ghost Authoring Component on it, and the ghost authoring component has to have Default Ghost Mode = Predicted
this is also what i do in my project which works
i remember being surprised that you couldnt' not have it be a prefab
but it's something about how they generate code for serialization or some shit
All of my spawned ghosts are prefabs
and do they have ghost authoring component on them?
Yep
wtf.
They also have the new cute icon in the hierarchy
!
sigh. well. my next idea is that we just didnt' test predicted ghosts without physics bodies. which i guess is possible.
i'll ask around
i forget what the empty cube icon means
I don't know either, but I think the From field being filled means it comes from a prefab
ok, asked; they may or may not be around right now though
Awesome, thanks! I'll keep messing around, but I feel like I've tried everything at this point
Ill see if I can create a reproduction project in the meantime ๐คท
from cristian the netcode man: In 1.0-exp if there is no predicted ghost with dynamic physics (have PhysicsVelocity) in the scene, the PhysicsGroup does not run and the PhysicsWorld is not built, unless the LagCompensation is enabled. So that may be case they are hitting. In 0.51 things are slightly different. Predicted Physics must be enabled by using the PredictedGhostConfig. And the physics runs for every prediction tick, as soon as there are PredictedGhost. If predicted physics config singleton is not present, physics will run in the FixedStepSimulationGroup as usual.
I'm guessing that is the issue then. Is PhysicsVelocity the only requirement for the system to run? Since a dynamic physics object would also require a PhysicsBody
I'll test adding those components and enabling lag compensation and let you know if that helps
This was definitely the issue.
Everything works as it did before if any single entity that is owned by the world (i.e. any ghost on the server, or a predicted ghost on the client) has a PhysicsVeclocity component on it, or I turn lag compensation on.
I guess It's kind of a weird workaround for now, since I don't really need either of those things, and I'm not sure what kind of performance implications lag compensation has in storing additional collision worlds.
In an ideal world whatever initializes the netcode physics systems checks if any kind of physics simulation is even used, and removes all physics based systems except the ones required to build the physics / collision worlds for raycasting needs, although I have no idea how complicated that would be.
I have this set after all:
Ideally the behavior on the client and server worlds would not differ from the one on the default world if physics is disabled (meaning no simulation but it is possible to query collisionworlds)
got it, makes sense!
Should I make a forum post explaining the use-case for such a feature or could you pass it on?
already forwarded ๐