Visual Debugger ModelView Matrix


I have a very high coordinate value for the mesh of my object and this give me some error at rendering time.
The fist solution that I have found is to manually translate my object but I prefer to mantain the original coordinates value.

in order to translate my scene near the origin it’s possible set the Model view matrix of my physx visual debugger?


I don’t quite follow you. What does PhysX visual debugger have to do with your object’s graphics mesh? Are you saying that your shape is displaced from the origin of the actor by a large distance?

I have found a good way to solve my problem:
void PxScene::shiftOrigin(const PxVec3 & shift)

This works fine for me because I have a distance related precision issues.

But I the problem is that shiftOrigin function seems to work only with the actor that are already loaded into the scene.

So this workflow works fine:

  • create scene
  • append a sphere to the scene
  • shiftOring

But this workflow doesn’t works fine:

  • create scene
  • shiftOrigin
  • append a sphere to the scene

OK, maybe can be acceptable in some cases but if I want to be able to ADD a new actor to the scene a runtime?

What I would expect is that the shift vector will get subtracted from all object positions.

Any suggestions?

I known that I can solve this issue apply manually this subtraction at every object coordinates but I want to be able to use serialization and my object have been saved with original coordinates.


This is by design. In order for PhysX to relocate objects when you load them, it would have to assume that they were stored in some global coordinate space – but the common scenario for origin shifting is that you would serialize chunks of the world relative to an origin for each chunk (so that you retain a reasonable amount of precision) and then relocate the actors in each chunk relative to wherever you’ve set the origin when you load them in. This is the recommended practice.