Sign in to follow this  
Tseng

Top down shooter with multiple height levels

Recommended Posts

Hello,

I'm making a top down shooter, which has several height levels. What I mean, there is the "top" level where the players ship and most enemies are at. There is the "middle" level, where destroyable buildings, bridges etc. are and there is the "bottom" level where you have ground units.

Now my real problem is, the projectiles. When I shoot lasers out of the player ship, it will hit enemies on the same height level normally. In order for it to trigger the destructible objects in the lower levels, I've just made projectiles with a very high/tall collider. While it "works", it has of course some optical impacts, so the shoots don't trigger correctly when the shoot "visually" hits the object an it (the laser, rocket etc.).

So is there any way to solve this problem elegantly? It's a 3D top down shooter with perspective camera.

Share this post


Link to post
Share on other sites
Leave projectiles with natural shapes, and check collisions with appropriate invisible proxies in addition to the actual objects.

For example, a cylinder (or, in general, a prism) extending above a level 0 building, spanning the whole height range of level 1, lets the building be hit by horizontal shots fired at level 1 (but not at level 2 further above).

Share this post


Link to post
Share on other sites
Well, I already added a long collider. I've added 3 screenshots of my current prototype.

This is a screenshot shortly before it hits the first "building". In the top-left view you see the scene from top above (orthographic view) while in the right window you see the actual game view (perspective).

It's already quite visible what's wrong. In the right one, the laser shots are already at a position where they should get triggered and do damage to the building.
[attachment=7415:perspective1.jpg]

Next one shows the first frame when the shot's collider hit the buildings collider. The scene view shows the view from the side. As you see all 3 colliders of the laser intersects with the building. Works so far. However, the problem is that in the game view, the laser is far inside (top of) the building) so it causes quite some strange perspective. It gets even worse, when a ground unit shoots, so the laser offsets are quite significant.

[attachment=7416:perspective2.jpg]

Same as the above, just with top view on the scene
[attachment=7417:perspective3.jpg]

Technically I'd have to make a cone-like collider (the middleware I'm using, Unity3D, only offers Cube, Sphere, Cylinder, Mesh and Wheel (for cars) collider) to correct this perspective. Even though I doubt that would fix the problem when it's fired from ground position.

Someone ever had to solve this kind of stuff in an top-down shooter?

Share this post


Link to post
Share on other sites
So you'd like to check collisions in screen space? In the first screenshot, the bullets should have hit as soon as they are drawn over the dark red faces?
You could project relevant faces of the building (the footprint at ground level?) and the projectile onto the screen plane, with the same transform you use for the camera, and check for a 2D collision.

Share this post


Link to post
Share on other sites

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