Dudley

Hi all,

Just getting to grips with XNA - great fun so far :)

I wondered whether anybody could suggest to me how I might tackle the following problem...

Think back to Asteroids - your little ship could loop from one side of the screen to the other. I want to apply the same priciple to a 3d landscape - ie when my ships flys towards the "edge" of the terrain it loops back to the other side of the terrain seamlessly so that it feels like you are flying over an infinate terrain.Now there are various methods to tackle this problem and I have in fact successfully completed part of the task.

My question relates to the other 3d objects flying around in the sky and the ships field of view. If the ship is moving near to the edge of the terrain potentially its field of view frustum will be split over the far terrain edge and the near terrain edge. So, if the ship is near one edge of the terrain - how can i check whether objects over on the other side of the terrain should fall within the ships field of view I hope this makes sense!

Ultimately if I decide an object is within the ships field of view I can just translate the object by the width of the terrain so that it physically appears in front of the ship - its just the method of finding if something is within a FOV when theat FOV is split over two edges which is eluding me.

Thanks in advance for any suggestions!



Re: XNA Framework viewing objects on a looping landscape?

Pocketmnky

Well, although I suppose that question doesn't really have anything to do with the XNA Framework per se...

Essentially what you might want to try here is to create a border strip of your map that represents when your repeated map and objects would be visible along each edge. The strip should be as thick as the maxium draw length of your game. Whenever your player is in one or more of those strip areas, you know that you are going be drawing any objects that are in the strip area of the opposite side.

It's a little bit of double work, but you can always make it alot quicker with a propper data structure. Thats all I've got off the top of my head.






Re: XNA Framework viewing objects on a looping landscape?

Pon t3h pony

I would create two frustrums. From the original frustrum, cull it against the edge of the world, and draw everything in it. Then, translate the other portion of the frustrum to the other side of the world, and render everything in there.