Jump to content
  • Advertisement
Sign in to follow this  
homer_3

Mesh Intersect throwing AccssViolationException?

This topic is 3712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to test if a ray intersects with a mesh and when I do
box.Intersect(_camera.Position, new Vector3(1, 0, 0),out info);

I get an AccessViolationException error, at run time, that says I'm attempting to read or write to protected memory. box was created using Mesh.Box(). Can anyone shed some light on why I'd be getting this error?

Share this post


Link to post
Share on other sites
Advertisement
Before I tried testing for the intersect I drew the box on screen and it showed up fine. I'll check the link though and see what I can find.

Share this post


Link to post
Share on other sites
What details do you get with the access violation (I don't know about C#, but in C++ you get a message like "Access violation (0xC0000005) reading location 0x00000000")? Another alternative is that _camera isn't a valid object.

Share this post


Link to post
Share on other sites
I found the issue. It didn't like where I was calling intersect. box must not have been fully initialized even though I put it in an if statement that checked to make sure box wasn't null. I tried checking for an intersect immediately after doing mesh = Mesh.Box() and got no error.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!