Jump to content

  • Log In with Google      Sign In   
  • Create Account


3D Level Wraparound?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Carandiru   Members   -  Reputation: 212

Like
0Likes
Like

Posted 24 April 2009 - 07:10 PM

I'm trying to wrap my head around it. I'm guessing I would be checking the boundaries for the positions of such objects and then having two objects of the same type until it is 100% on one side or the other of the wraparound! Lol I bet that was a mindtwister.... If anyone can recommend a simple, concise implementation for a 3D level wraparound based on defined size of the level for where the wraparound begins... please let me know!!!

Sponsor:

#2 Captain P   Members   -  Reputation: 1088

Like
0Likes
Like

Posted 24 April 2009 - 07:57 PM

Sounds like you'll want to do some custom rendering here (looping through the scene multiple times, with multiple offsets - or probably something more advanced/optimized than that). As for positioning objects, you probably don't need to copy objects, but you will likely need to act as if they're on multiple locations, so for collision purposes, you'd check those objects twice (or more times, depending on how many edges they're actually crossing).
Create-ivity - a game development blog Mouseover for more information.

#3 zedz   Members   -  Reputation: 291

Like
0Likes
Like

Posted 24 April 2009 - 10:06 PM

its actually quite simple once u grasp it

if ( distance( A - B ) > 0.5*world_size )
then u need to be going the other way, thus perform some subtraction to the point

one of the points(i.e. A) could be the center of the screen/world/player/camera

I hope Ive explained that well enuf

#4 Carandiru   Members   -  Reputation: 212

Like
0Likes
Like

Posted 25 April 2009 - 07:15 PM

Thank you, I got it working - sorta.

So as I travel to the edge of the world, imagine a cube and I hit the top,bottom,left,right,far,near plane of the level bounds the position jumps to the opposite side.

Awesome, yes as the player wraps to the other side of the world.

But since it is first-person, when you get the the level bound and you are repositioned to the opposite side of the world - everything you see changes.

So what I'm wondering now, is how to see everything "infinitely".

So instead of a "pop" to the opposite side of the world, it would appear "seamless".

#5 KulSeran   Members   -  Reputation: 2183

Like
0Likes
Like

Posted 25 April 2009 - 08:20 PM

I would say the easiest way would be to reverse your logic.
Place the player at (0,0,0) and keep him there.
Break your world into tiles so you have at least 9 unique tiles.
You can create a world matrix for each tile in the same way you'd make a world matrix for any object in your world.
And then "scene graph" style, tie every object in your world to a tile so it's position is relative to the tile's center (if something gets knocked across tile bounds, you'd probably want to transfer it to another tile).
You can use the tile's world matrix to transform any ray into tile space for collision checks or the like, and if a collision check reaches the end of your world space, you can wrap the ray around the other side.
You can now just render tiles around in an "infinite" plane around your player, and scroll them by the player as he moves.
Once a tile reaches one end of the world, just pop it to the other, hopefully it is out of the fog of war from your player, and they won't notice the pop (or you can fade in the alpha of that entire tile).


#6 Edge Damodred   Members   -  Reputation: 169

Like
0Likes
Like

Posted 26 April 2009 - 12:18 AM

You could try implementing a portal system and put portals at the boundries of your world and tie them to their corresponding areas. Not exactly sure how to implement said system but I'm sure someone here has done some work with it.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS