Flip Y-coordinates of everything?

Hi guys, happy new year!

Very quick, and possibly very simple solution, but I can’t find anything that works properly.

I want every object in my scene to move upwards when a negative Y position is given, and downwards when a positive Y value is given. The default up vector is 0, 1, 0 by default. I’ve tried changing this to 0, -1, 0, but this doesn’t seem to do anything.

I found this (old) topic with the same question, but without a definitive answer. Easiest way to make positive-Y axis go downward (without using scale)? - #4 by trusktr

I’ve tried camera.scale.y = -1, which seems to work, but I’m wondering about the possible (negative) side-effects of this approach.

Calling Object3D.DefaultUp.set(0, -1, 0) before rendering anything doesn’t seem to do much (is this a bug, or am I using this wrong?).

I’m trying to avoid a manual conversion (at all costs) between my coordinate system and the renderer.

Thanks in advance!

Edit: To help visualize the issue. Here is a screenshot of a level blueprint:

This is the rendered scene (don’t mind the basic unlit materials for now)

By setting Object3D.DefaultUp.set(0, -1, 0), I’m expecting the scene to be flipped on its Y-axis, but it doesn’t. When debugging things like this.scene.up, I am seeing the negative Y-value though.

It is important that the values in position vectors remain intact, meaning they should reflect their coordinates as defined in the level data.

What am I missing?

1 Like

Since camera.scale.y = -1 seems to mess up other parts (skyboxes becoming invisible etc.), I’ve now fixed it by rotating the camera like this:

camera.rotation.order = 'XZY';
camera.rotation.z     = Math.PI;

I can work with this, since my game has a fixed “top-down” view anyways. It’s not ideal, and rather hacky IMHO. If anyone has a better method of fixing this, please let me know.

Thanks!

Could you nest all of your objects in a parent Object3D and set the scale of it to 1,-1,1?

EDIT: apologies I’ve read again and seen the reference to the link to not use scale, although I’m sure this could work if you call updateMatrix possibly…

I tried that with the scene. But the camera is also parented to another object in the scene, which cancels out the effect.

I’m afraid that using scale in general will cause more (unforeseen) side-effects than changing the rotation order. Since my coordinate system works on a very simple X/Y-grid, I had to swap the rotation order of the camera anyways.

I was more looking for an out-of-the-box solution like setting the DefaultUp vector, but that doesn’t seem to do anything at all. I don’t get why…