Add the ability to look-at in model-space.

This is a much simpler attempt to solve the same problem as #76060, but without breaking any compatibility.

* Adds a description of what model space is in the Vector3 enums (MODEL_* constants). This has the proper axes laid out for imported 3D assets.
* Adds the option to `look_at` using model_space, which uses Vector3.MODEL_FRONT as forward vector.

The attempt of this PR is to still break the assumption that there is a single direction of forward (which is not the case in Godot)
and make it easier to understand where 3D models are facing, as well as orienting them via look_at.
This commit is contained in:
Juan Linietsky
2023-04-15 10:01:43 +02:00
committed by Silc Lizard (Tokage) Renew
parent d5c1b9f883
commit 5fdc1232ef
11 changed files with 55 additions and 22 deletions

View File

@ -404,11 +404,29 @@
Down unit vector.
</constant>
<constant name="FORWARD" value="Vector3(0, 0, -1)">
Forward unit vector. Represents the local direction of forward, and the global direction of north.
Forward unit vector. Represents the local direction of forward, and the global direction of north. Keep in mind that the forward direction for lights, cameras, etc is different from 3D assets like characters, which face towards the camera by convention. Use [constant Vector3.MODEL_FRONT] and similar constants when working in 3D asset space.
</constant>
<constant name="BACK" value="Vector3(0, 0, 1)">
Back unit vector. Represents the local direction of back, and the global direction of south.
</constant>
<constant name="MODEL_LEFT" value="Vector3(1, 0, 0)">
Unit vector pointing towards the left side of imported 3D assets.
</constant>
<constant name="MODEL_RIGHT" value="Vector3(-1, 0, 0)">
Unit vector pointing towards the right side of imported 3D assets.
</constant>
<constant name="MODEL_TOP" value="Vector3(0, 1, 0)">
Unit vector pointing towards the top side (up) of imported 3D assets.
</constant>
<constant name="MODEL_BOTTOM" value="Vector3(0, -1, 0)">
Unit vector pointing towards the bottom side (down) of imported 3D assets.
</constant>
<constant name="MODEL_FRONT" value="Vector3(0, 0, 1)">
Unit vector pointing towards the front side (facing forward) of imported 3D assets.
</constant>
<constant name="MODEL_REAR" value="Vector3(0, 0, -1)">
Unit vector pointing towards the rear side (back) of imported 3D assets.
</constant>
</constants>
<operators>
<operator name="operator !=">