This project is read-only.

XNA 3 problems

Jan 15, 2009 at 5:59 PM

Used the new XNA 3 versions and came across a couple of things.

1) The clouds do not appear, you get a black and yellow texture instead
2) Collision not working.

If you use the collision point, you can go straight through the walls.

I changed it to compare the cameraPosition with the collision point and if they are not equal, use the old camera position.
This proves that your code is detecting collisions, but is calculating the collision point incorrectly.

I guess you need to move the collision point back a touch.

Otherwise nice and handy code.
Feb 7, 2009 at 9:55 AM
Hi! Sorry for the delay but I've been busy with school and such.

A black and yellow texture means that the texture or shader is not where the BSP thinks it is. A log file is in bin/debug/ and should help you figure out where the discrepancy is.

I didn't actually write the collision code, and I'm only now really looking at it for the first time. A lot of the variable names are poorly written and the method used is simply confusing. The way I see it, you need to generate the collision data, and if the end point and collision point are not the same, set the position of the ray to the collision point. If you set it past the collision point, the ray is now inside the brush and won't collide again and move through the wall.
Feb 7, 2009 at 10:19 AM
I think inaccuracies in the maths mean that you cannot use the collision point itself.

If you use the collision point, you can walk through the walls.

You need to adjust the collision point a small distance to prevent this.

Feb 8, 2009 at 4:41 AM
I think the code already picks a collision point that has been adjusted to be slightly before the actual collision point. I'm not so sure though. Aanand's code looks pretty similiar to this code here:

At the very least, I've not noticed any problems using the collision point to place my camera. In my admittedly small amount of testing, walls (sky textures too) will stop movement. The camera's view kind of goes through the wall, but that's to be expected when the two are coplanar. Regardless, a couple thousandths of a percent adjustment to the collision point would be pretty harmless and alleviate any problems, should they exist.