Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - serialize #28

Open
sancelot opened this issue Jan 18, 2024 · 7 comments
Open

Question - serialize #28

sancelot opened this issue Jan 18, 2024 · 7 comments

Comments

@sancelot
Copy link

sancelot commented Jan 18, 2024

Hi,

Is there possibility to use serialization, or to debug PhysX scene ?
and is Cooking available ?

Regards

@fabmax
Copy link
Owner

fabmax commented Jan 19, 2024

PxSerialization is available, although I never really used it. Debugging isn't really possible however (I think someone maneged to use a websocket connection to connect to the PhysX Visual Debugger in the past but that was with PhysX 4. With PhysX 5 PVD isn't really supported anymore).

The cooking functions for PxConvexMesh, PxTriangleMesh and PxHeightField are available via PxTopLevelFunctions.prototype. The old PxCooking class is deprecated and not used anymore.

@sancelot
Copy link
Author

Thanks for your reply.

I gave it a try but faced to unattended issue , meshDesc polygons does not exist

let meshDesc = new this.PhysX.PxConvexMeshDesc();
  meshDesc.points.count = vertices?.length;
      meshDesc.points.stride = Object.keys(vertices[0]).length; // * 3 ? ??
      meshDesc.points.data = vertices;
      meshDesc.polygons.count = indices.length / 3;
      meshDesc.polygons.stride = 3 * Object.keys(indices[0]).length;
      meshDesc.polygons.data = indices; // Indices can be 16 or 32 bit. The strides used here assume that vertices and indices are arrays of PxVec3s and 32bit integers respectively with no gaps in the data layout.
      meshDesc.flags = this.PhysX.eCOMPUTE_CONVEX;
      console.log(this.PhysX.PxTopLevelFunctions.prototype.CreateConvexMesh);
      const convexmesh = this.PhysX.PxTopLevelFunctions.prototype.CreateConvexMesh(cookingParams, meshDesc);


@fabmax
Copy link
Owner

fabmax commented Jan 22, 2024

Ah yes that's true. Do you need polygons? I never had a usecase where I needed them and it works just fine with only points.

@sancelot
Copy link
Author

sancelot commented Jan 23, 2024 via email

@fabmax
Copy link
Owner

fabmax commented Jan 23, 2024

Then PxConvexMesh is probably not the right choice. This is only for small (up to 255 vertices) convex meshes (see here)

For "regular" meshes you need to use either PxTriangleMesh (but keep in mind that triangle meshes can only be static or kinematic, not fully simulated dynamic).

@sancelot
Copy link
Author

you are right ,PxConvexMesh won't be a good choice in my case.
I will only use collide engine, in a not very usual mode.
I will teleport collide objects and detect collisions without using physics, that may lead to use the collide engine forcing some activation states.

@fabmax
Copy link
Owner

fabmax commented Jan 23, 2024

Yes that should work.

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

No branches or pull requests

2 participants