Re: Lucia - OpenSource AudioGame engine written in Python
@16, that does not facilitate the alteration of direction rotations. The only difference between a left-handed coordinate systemand a right-handed coordinate system (as I remember explaining on this forum multiple times) is the Z-coordinate. In a right-handed coordinate system, the positive X and Y axes point right and up, and the negative Z axis points forward. In a left-handed coordinate system, the positive X, Y, and Z axes point right, up, and forward respectively. As an example, OpenGL uses a right-handed coordinate system. I believe OpenAL does too. All you need do is negate the Z axis when working with right-handed coordinate systems and you will be fine. (FMOD uses a left-handed system by default, though this can be altered to use a right-handed coordinate system for compatibility if your using OpenGL. BASS uses a left-handed coordinate system only with no option to alter that setting.) A function in Python to set coordinates might look like so:
def set_coords(x: int, y: int, z: int):
self.x = x
self.y = y
if self.righthanded_coordinate_system:
if z < 0: # We're going backwards
self.z = math.abs(z)
else: # Forwards
self.z = -z
else:
self.z = z
All you would then need to do is keep that in mind when updating 3D positions. You could even abstract this into a module:
import math
def calc_coords(x: int, y: int, z: int, use_right_handed: bool)->(int, int, int): if use_right_handed: if z < 0: # We're going backwards return (x, y, math.abs(z)) else: # Forwards return (x, y, -z) else: return (x, y, z)
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector