Roleplaying Video Games Entertainment & Media Politics & World
General Spirituality & Philosophy Worldbuilding Creative Forum
The Sports Center Science, Math, & Technology The Nostalgia Forum Sexuality

# Creative Forum

## @chiarizio: 3d spherical effects

Posted 1 Month ago by Riven

How do you deal with three-dimensional effects?
Subterranean or submarine? Burrowing or swimming?
Or atmosphere— flying?

While my current game is 2d so this is somewhat irrelevant, I have thought about these questions a lot for my next game (which has a lot of 3d spherical/etc objects you can walk on).

The basic answer is you don't use cartesian coordinates at all -- instead of an x you have an angle, instead of a y you have an angle, and instead of a z you have a distance from the center of the sphere.

When you move you're naturally moving at an angle around the sphere, not in a straight line.

When you go "down" or "up", you're actually going closer or father away from the sphere center.

## There are 6 Replies

That makes excellent sense!
Latitude, longitude, and altitude.

1 Month ago
chiarizio

Yeah latitude and longitude are conveniently also represented as angles, which is exactly how polar coordinates work.

1 Month ago
Riven

Spherical coordinates, you mean.
Polar coordinates are two-dimensional. They correspond to cylindrical coordinates as well as they do to spherical coordinates.
...
I like what you’re doing.

1 Month ago
chiarizio

They correspond to cylindrical coordinates as well as they do to spherical coordinates.

Huh, yeah, that makes sense. I guess you'd have an angle measure and two distance measures in that case.

• Cube -- three distance measures
• Cylinder -- two distance measures, one angle
• Sphere -- one distance measure, two angles

I wonder if there's a hypothetical (or real) shape where you'd have three angle measures?

• 1 Month ago
Riven

There’s a system of which all three of those coordinate systems you mentioned are special cases.

I think it goes something like this.

Pick a and b and c.
Write this equation in s:
a/(x^2 -s) + b/(y^2 -s) + c/(z^2 - s) = 1

This is cubic in s.
It has three solutions.
All of the points (x,y,z) for which one particular value of s is a solution, form a surface.
The set of three solutions — three values of s which are roots of that cubic — form a co-ordinate system.

For the correct values of a and b and c you can get three mutually perpendicular sets of parallel planes;
Or a set of parallel planes, a set of planes perpendicular to those all containing the same line, and a set of cylinders all having that line as an axis;
Or a set of planes all having a certain line in common, a set of cones all having that line as their axis and all having a certain point as their vertex, and a set of spheres all having that vertex as their center.

...

I may have misremembered.

1 Month ago
chiarizio

@Riven:
In spherical co-ordinates:
Loci of equal longitude are planes, each of which contains the axis.
Loci of equal latitude are cones, each of which has the origin as its vertex and the axis as its axis.
Loci of equal altitude are spheres, each centered at the origin.

I bet you already knew that. Thought I’d mention it anyway.

1 Month ago
chiarizio