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

PxRenderBuffer array fields aren't mapped properly #70

Open
dustContributor opened this issue Jun 23, 2024 · 0 comments
Open

PxRenderBuffer array fields aren't mapped properly #70

dustContributor opened this issue Jun 23, 2024 · 0 comments

Comments

@dustContributor
Copy link

Hi! I was researching how to implement a debug visualization using the official docs:

https://nvidia-omniverse.github.io/PhysX/physx/5.4.0/docs/DebugVisualization.html

const PxRenderBuffer& rb = scene->getRenderBuffer();

for(PxU32 i=0; i < rb.getNbPoints(); i++)
{
    const PxDebugPoint& point = rb.getPoints()[i];
    // render the point
}

for(PxU32 i=0; i < rb.getNbLines(); i++)
{
    const PxDebugLine& line = rb.getLines()[i];
    // render the line
}

It seems the array fields for points, lines, etc in PxRenderBuffer are mapped to a single element with no way to index into them.

[Const] PxDebugPoint getPoints();

I think PxDebugLine.arrayGet for example can be used to work around this:

PxRenderBuffer renderBuffer = physxScene.getRenderBuffer();
int pointsLength = renderBuffer.getNbPoints();
int pointsBaseAddress = renderBuffer.getPoints().getAddress();
for (int p = 0; p < pointsLength; ++p) {
	PxDebugPoint point = PxDebugPoint.arrayGet(pointsBaseAddress, p);
}

But I believe it should be exposed like the getAnyHit(index) accessor from PxSweepResult

[Const, Ref] PxSweepHit getAnyHit(unsigned long index);

Where you do

int hitsLength = sweepResult.getNbAnyHits();
for (int h = 0; h < hitsLength; ++h) {
	PxSweepHit hit = sweepResult.getAnyHit(h);
}
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

1 participant