Sign in to follow this  

Troubles in isometric space...

This topic is 2664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I am working on a 2D isometric game (my first isometric game!), but unfortunately I am stuck, so I hope some people here could enlighten me.

My main trouble is related to how I project the camera view area into my grids plane (defined in x-z plane). Currently I am doing it as follows:

1. I define my view area in the X-Y Plane (aka screen), I move the camera around using this view area.

2. To find the visible area on my grid, I project the 4 corners of my view area to isometric space (x-z plane) and compute a axis aligned bounding box from this 4 points.

3. This projected area (the AABB in x-z plane) is what I use to for intersections test against my entities / tiles rectangles (also in x-z plane).

This approach works fine ONLY if my objects have a height == 0 (on plane), if I test this area against a entity with a height of 64 (to say something), it miss it at some places, mostly at the corners.

I guess this trouble is related to how I manage my objects with a height > 0,
I just sets its bounding box size to be the radius of the entity, much like

vector max = new vector(entity_width, entity_height, entity_length);
float radius = max.length() * 0.5;

entity_box.setFromCenterExtents(entityPos.x, entityPos.y, entityPos.z, radius, radius);

Thanks in advance,
Oscar


Share this post


Link to post
Share on other sites
This sounds simply like your frustrum-culling is looking only at the ground plane, and expecting your objects to exist at ground level.

If you have a fixed camera angle, then the workaround is simple; objects have to put their view-projected AABB into the view-spatial lookup structure (and probably while keeping their actual AABB in the now-separate world-spatial lookup structure). To avoid two separate spatial lookup structures, maybe you could create for each object a "solid" and "phantom" rectangle, the latter of which is used for view culling, and the former for collision checks.

If you don't have fixed camera angle, then all objects need to update their phantom hit rectangle whenever the camera rotates (around any of the three axes). Because you're using an orthographic projection (you are using an orthographic projection, not just an isometric-like perspective projection, right?), you don't need to update the phantom rectangles when moving the camera as well.

Share this post


Link to post
Share on other sites
Hey Wyrframe! Thanks for your help, I really appreciate it.

Now, regarding your idea, I liked the "solid" and "phantom" rectangle method, it is elegant and simple to implement, and yes; I am using a fixed camera angle with orthographic projection so it will fit fine in my current code ;)

Best Regards,
Oscar

Share this post


Link to post
Share on other sites

This topic is 2664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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