Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Spritzen
16
Years of Service
User Offline
Joined: 12th Aug 2009
Location:
Posted: 21st Apr 2010 22:21
I'm writing a 3d asteroids, but I'm making the view fixed and top down like the 2d original. What is the best way to simulate or actually do the screen wrap, so if I fly off the screen at the top, I come in from the bottom? I can't just touch the top and it pops to the bottom as that, well, doesn't look very good. If part of the nose is off the top then I'd like to see part of the nose at the bottom.
The Viking
17
Years of Service
User Offline
Joined: 21st Oct 2008
Location: Asgard
Posted: 22nd Apr 2010 04:37
i don't really know the proper solution for this, but one idea that pops into mind is to have 2 of the 3d models, but one is hidden. Have both move together and when you change the angle of one, it changes the other as well. When your ship is less than the x or z value it shows the other 3d model. What you could do then is position the second 3d model at the bottom.

So if the top of your screen is x value of say 100 and the bottom a value of 200 and the tip of your ship is at an x value of say 99. That means that it's 1 units lower. You could position the second ship at a x value of 200 - (100-99) and then show the second object. Once the first ship is completely out of the screen, position it where ship #2 is and then hide ship #2.

Just an idea as to how i would first attempt it if i didn't know the right way as i don't, haha.

www.myspace.com/norseblod
MayoZebraHat 1979
18
Years of Service
User Offline
Joined: 21st Dec 2007
Location:
Posted: 22nd Apr 2010 04:47
I did this in 2d for a similar game and The Viking has the right idea. When there is a collision with the ship and the outside boarder, you make a clone who's location is the original ships location and jump your first ship just off screen on the other side where you can then ease in the original ship then ease out and delete the clone.
The Viking
17
Years of Service
User Offline
Joined: 21st Oct 2008
Location: Asgard
Posted: 22nd Apr 2010 04:51
AH, that would be a little better, would cut out all the extra steps in mine, and for the most part only have one object on screen instead of the two.

www.myspace.com/norseblod
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 22nd Apr 2010 09:00
That could be a solution if you need only the ship to have this behavior, but what if every object, (and if they are many)leave the screen shows in oposite direction?

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Fantasy Multimedia
16
Years of Service
User Offline
Joined: 20th Apr 2010
Location: Reno, NV
Posted: 22nd Apr 2010 09:37
Quote: "That could be a solution if you need only the ship to have this behavior, but what if every object, (and if they are many)leave the screen shows in oposite direction?"


If that is the case, then you could either:
A) Use a second camera
or
B) Clone everything (clones aren't very expensive, but I don't think collision detection works on cloned objects (not in sparkys anyways))
Spritzen
16
Years of Service
User Offline
Joined: 12th Aug 2009
Location:
Posted: 22nd Apr 2010 15:22
Yeh, I was thinking of creating a duplicate of the object off screen, this would need collision detection though. So a clone won't work for me, but what if I create all the objects I need off screen and cycle them around ready to come on screen when needed? I'm holding all the co-ords in a UDT so I can grab the Z angle and velocity from the originals.

I was hoping there was some other trick I could use, that would wrap 3d space somehow.

Fantasy, how could you use a second camera?
The Viking
17
Years of Service
User Offline
Joined: 21st Oct 2008
Location: Asgard
Posted: 22nd Apr 2010 20:02 Edited at: 22nd Apr 2010 21:00
Actually, I cloned objects act as their own objects, therefore they do have thier own collision, even through sparky's. They do not share the same animations, or textures, so they are their own.

I have used the command before, and unless you plan to get into 200+ objects on the screen at any given time with over 1000 poly's per unit, it shouldn't slow down the program at all.

EDIT: For the most part, you shouldn't have to worry about the collision if the two objects are overlapping one another, it will still collide with object 1, and, for your purposes, append object may work just as well, if not better, because append object shares texture and angle data, so you wouldn't have to add the extra lines to change the angle of the second object. If I am wrong, please correct me.

www.myspace.com/norseblod
Fantasy Multimedia
16
Years of Service
User Offline
Joined: 20th Apr 2010
Location: Reno, NV
Posted: 22nd Apr 2010 22:03
Quote: "Fantasy, how could you use a second camera?"
Scratch that, doing it with a second camera would probably be overly-complicated.

Quote: "ctually, I cloned objects act as their own objects, therefore they do have thier own collision, even through sparky's."
Insert foot into mouth I believe I meant instanced objects, not cloned. I have been out of the loop for a few years... A thousand pardons
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Apr 2010 17:11
Quote: "I can't just touch the top and it pops to the bottom as that, well, doesn't look very good"


I would do exactly that, but only do the wrap-around when the ship is fully off the screen. It is placed fully off the screen in it's new position too, so it does actually look right when you are playing.

More than one ship object must surely complicate things with collision too?

TDK

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 24th Apr 2010 17:13
Quote: "More than one ship object must surely complicate things with collision too?"


Not necessarily. If you handle the collision for the second object the same as the first object, there should be no problem. To show what I mean, let's say object 1 is the ship object, object 2 the copy, and object 3 an enemy bullet. You'd check collision like this:



TheComet

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Apr 2010 21:46
Agreed it's not that difficult, but it does complicate things a little for new programmers. I was assuming there would be four ships - two for left/right wraparound and two for top/bottom. So:

success=object collision(1,bullet) or object collision(2,bullet)

would actually have to be:

success=object collision(1,bullet) or object collision(2,bullet) or object collision(3,bullet) or object collision(4,bullet)

And that's only for the ship collision with bullets. You would also have to have the same for multiple asteroids colliding with the ship and is really the only reason I suggested using just one ship object and letting it go completely off the screen before wrapping it around to the other side.

But both would work!

TDK

The Viking
17
Years of Service
User Offline
Joined: 21st Oct 2008
Location: Asgard
Posted: 25th Apr 2010 05:04 Edited at: 25th Apr 2010 05:04
Or just use a For/Next statement and go:



But, I guess that's kinda obvious I know...

www.myspace.com/norseblod
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Apr 2010 14:35
Quote: "I was assuming there would be four ships - two for left/right wraparound and two for top/bottom."


That would be a bit over the top, since you only have a maximum of 1 intersection at any given time. But I agree that it would be much simpler to wrap with only one ship, as you say.

TheComet

Login to post a reply

Server time is: 2026-07-26 02:38:25
Your offset time is: 2026-07-26 02:38:25