When serializing a scene, properties like the mesh's physicsImpostor and mass can be serialized. However, why can't the mesh's physicsImpostor and related properties be loaded when using the serialized file to load the scene?

i use “BABYLON.SceneSerializer.Serialize(scene)” to serializer the scene and find it has

but i use ‘SceneLoader.AppendAsync’ to load this scene i find

image

CC @Cedric . Would probably be helpful to have some form of a reproduction

Yes, a repro is needed. Thanks for providing a PG and steps.

1 Like

i created a pg

Maybe you need to enable physics first and then deserialize the model.

Interestingly, though, after turning on physics, the ball has physics and falls, but sphere.physicsImpostor is still undefined.

I tested it the same way, but the physics seem to become strange when multiple scenes are stacked. Additionally, in this case, the sphere.physicsImpostor cannot be modified a second time.

I looked at the babylonFileLoader source code, and there doesn’t seem to be anything in there about a physics Impostor.
And since the loader actually creates a physics engine, it might be wrong to create the engine in advance.

So my last playground was probably some kind of coincidence and bug.

Hell, then why does the ball physically drop after creating two physics engines.

A physics engine is created in the PG and a 2nd one when deserializing. As there is already a physics engine used by the scene, it’s ignored and 1st engine is used for dynamics.

The problem is: why is the deserialized engine not working? I’m continuing the investigation

1 Like
2 Likes