NVIDIAGameWorks / PhysX

NVIDIA PhysX SDK
Other
3.11k stars 793 forks source link

Getting "read access violation" when calling "hit->actor->getName()" in Release mode #605

Closed The-Hambone closed 1 year ago

The-Hambone commented 1 year ago

In "Debug" mode, I am able to call this function without any issues, this is after performing a ray cast. I am providing an origin, direction and maxDistance. I have a player (cube) that has a -y velocity (gravity) being applied, I am raycasting to check for the ground every frame, I cannot seem to figure out what the issue is.

One thing I notice is whenever I am in release mode, my floating point values are slightly different for the velocty.y, I am handling velocity.y by standard means, applying gravity every frame * deltaTime. This issue is the same for true both precise and fast floating point model configurations in VS.

I made a reddit post about this that might add some more color if needed, this is pretty much my issue, I think I originally assumed some VS configuration changes originally caused this but after creating a new project and copying the files over, I still have this issue in Release mode. At one point PhysX did tell me something about a zero or negative ray distance but, I have not being able to get back to getting that error (I talk about this in the reddit post).

https://old.reddit.com/r/opengl/comments/xjapuz/weird_physx_read_access_violation_error/

In Release mode my ray origin is (-0.5, 4.05529, 0), dirY = -1, rayLength = (0.056425), velocity.Y = -0.056425, not able to retrieve the name after hit is determined not null (as well as the actor).

In Debug mode: ray origin is (-0.5, 4, 0), dirY = -1, rayLength = (4.31585e-05), velocity.Y = -4.31585e-05, works like a charm.

The-Hambone commented 1 year ago

It was an issue with references, I was bit by the handhold of debug mode once again.

Closing