Sign in to follow this  

Mesh Intersect throwing AccssViolationException?

This topic is 3502 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
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

This topic is 3502 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this