Isometric projection angles...

Started by
2 comments, last by Wyrframe 7 years, 10 months ago

Hi everyone. I'm trying to create a 2D spinning ball, but in Isometric projection.

I'm using the following code:
http://www.angryoctopus.co.nz/java4k/PoolTest.html
which seems to work fine for top down view. (If Java doesn't work for you, this is my HTML5 test: Pool Press X to toggle aXes display.)

pool.gif

Now I try to use this same code for my Isometric engine. So I rotate by 45 and 30 (yaw/pitch).
It seems to work fine, as long as my ball's axes are World axes aligned.

correct.gif

If they're not, I'm not sure what is happening.

wobble.gif

Also, when I rotate my view, what would be the correct rotation?

rotateview.gif

Spindizzy (Canvas)
Spindizzy (WebGL)

Press H for help. (A Aabb, W Wireframe, X aXes, 1/2 Rotate).

Advertisement

The projection from the basic view direction looks fine to me. Although I do notice in the Spindizzy example, you don't appear to be applying any friction against the ball spinning freely about the world vertical axis, which might be cause the appearance of wobble.

As for rotating the view... you're just rotating the ball around the view Z axis. You need to rotate the projection of the ball around the world vertical axis instead. You can tell this is what is happening by leaving the ball stationary with the number at the top. Rotating the view should leave the number at the top from all four directions, but instead you're rotating the ball as though looking straight down on it (where the view and world vertical axes are parallel).

RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.

'As for rotating the view... you're just rotating the ball around the view Z axis. You need to rotate the projection of the ball around the world vertical axis instead. You can tell this is what is happening by leaving the ball stationary with the number at the top. Rotating the view should leave the number at the top from all four directions, but instead you're rotating the ball as though looking straight down on it (where the view and world vertical axes are parallel).'

Agreed, that's actually what I'm doing. But it doesn't look right. What should be the actual angles for a dimetric projection?
When I rotate my view, I rotate by 90 degrees, so I rotate the ball by another 90 degrees (around the same 'yaw' axis I used for the original view).

Right, but your viewing angle is not aligned with world axes. You need to recalculate the ball's "display" rotation based on its "physics" rotation. Assuming in your Spindizzy example that +X is down-right, +Y is up-right, and +Z is straight up, your camera is 60° around X and 45° around Z away from looking straight down (sign will vary based on left- or right-handedness of rotation). That Z rotation should be increased or decreased by 90° each time you rotate the camera.

For minimal change from your current codebase and process... each frame you should make a COPY of your ball's physics rotation, and apply a view rotation to that to match it up to your viewing angle, and then render using that apparent rotation instead of the ball's actual rotation.

RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.

This topic is closed to new replies.

Advertisement