bevy/assets/models/ship/craft_speederD.gltf
Chris Biscardi 4d3f43131e
Use a ship in Transform::align example (#13935)
# Objective

The documentation for
[`Transform::align`](https://docs.rs/bevy/0.14.0-rc.3/bevy/transform/components/struct.Transform.html#method.align)
mentions a hypothetical ship model. Showing this concretely would be a
nice improvement over using a cube.

> For example, if a spaceship model has its nose pointing in the
X-direction in its own local coordinates and its dorsal fin pointing in
the Y-direction, then align(Dir3::X, v, Dir3::Y, w) will make the
spaceship’s nose point in the direction of v, while the dorsal fin does
its best to point in the direction w.


## Solution

This commit makes the ship less hypothetical by using a kenney ship
model in the example.

The local axes for the ship needed to change to accommodate the gltf, so
the hypothetical in the documentation and this example's local axes
don't necessarily match. Docs use `align(Dir3::X, v, Dir3::Y, w)` and
this example now uses `(Vec3::NEG_Z, *first, Vec3::X, *second)`.

I manually modified the `craft_speederD` Node's `translation` to be
0,0,0 in the gltf file, which means it now differs from kenney's
original model.

Original ship from: https://kenney.nl/assets/space-kit

## Testing

```
cargo run --example align
```

![screenshot-2024-06-19-at-14 27
05@2x](https://github.com/bevyengine/bevy/assets/551247/ab1afc8f-76b2-42b6-b455-f0d1c77cfed7)
![screenshot-2024-06-19-at-14 27
12@2x](https://github.com/bevyengine/bevy/assets/551247/4a01031c-4ea1-43ab-8078-3656db67efe0)
![screenshot-2024-06-19-at-14 27
20@2x](https://github.com/bevyengine/bevy/assets/551247/06830f38-ba2b-4e3a-a265-2d10f9ea9de9)
2024-06-20 00:58:00 +00:00

288 lines
No EOL
4.9 KiB
JSON

{
"extensionsUsed": [
"KHR_materials_unlit"
],
"asset": {
"generator": "UniGLTF-1.27",
"version": "2.0"
},
"buffers": [
{
"uri": "craft_speederD_data.bin",
"byteLength": 20120
}
],
"bufferViews": [
{
"buffer": 0,
"byteOffset": 0,
"byteLength": 6096,
"target": 34962
},
{
"buffer": 0,
"byteOffset": 6096,
"byteLength": 6096,
"target": 34962
},
{
"buffer": 0,
"byteOffset": 12192,
"byteLength": 4064,
"target": 34962
},
{
"buffer": 0,
"byteOffset": 16256,
"byteLength": 732,
"target": 34963
},
{
"buffer": 0,
"byteOffset": 16988,
"byteLength": 1368,
"target": 34963
},
{
"buffer": 0,
"byteOffset": 18356,
"byteLength": 456,
"target": 34963
},
{
"buffer": 0,
"byteOffset": 18812,
"byteLength": 1308,
"target": 34963
}
],
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"type": "VEC3",
"componentType": 5126,
"count": 508,
"max": [
1.4,
0.9,
1.11283529
],
"min": [
-1.4,
0,
-1.11283529
],
"normalized": false
},
{
"bufferView": 1,
"byteOffset": 0,
"type": "VEC3",
"componentType": 5126,
"count": 508,
"normalized": false
},
{
"bufferView": 2,
"byteOffset": 0,
"type": "VEC2",
"componentType": 5126,
"count": 508,
"normalized": false
},
{
"bufferView": 3,
"byteOffset": 0,
"type": "SCALAR",
"componentType": 5125,
"count": 183,
"normalized": false
},
{
"bufferView": 4,
"byteOffset": 0,
"type": "SCALAR",
"componentType": 5125,
"count": 342,
"normalized": false
},
{
"bufferView": 5,
"byteOffset": 0,
"type": "SCALAR",
"componentType": 5125,
"count": 114,
"normalized": false
},
{
"bufferView": 6,
"byteOffset": 0,
"type": "SCALAR",
"componentType": 5125,
"count": 327,
"normalized": false
}
],
"materials": [
{
"name": "metal",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.843137264,
0.870588243,
0.9098039,
1
],
"metallicFactor": 1,
"roughnessFactor": 1
},
"doubleSided": false,
"alphaMode": "OPAQUE"
},
{
"name": "metalDark",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.6750623,
0.7100219,
0.7735849,
1
],
"metallicFactor": 1,
"roughnessFactor": 1
},
"doubleSided": false,
"alphaMode": "OPAQUE"
},
{
"name": "dark",
"pbrMetallicRoughness": {
"baseColorFactor": [
0.274509817,
0.298039228,
0.34117648,
1
],
"metallicFactor": 1,
"roughnessFactor": 1
},
"doubleSided": false,
"alphaMode": "OPAQUE"
},
{
"name": "metalRed",
"pbrMetallicRoughness": {
"baseColorFactor": [
1,
0.628524244,
0.2028302,
1
],
"metallicFactor": 1,
"roughnessFactor": 1
},
"doubleSided": false,
"alphaMode": "OPAQUE"
}
],
"meshes": [
{
"name": "Mesh craft_speederD",
"primitives": [
{
"mode": 4,
"indices": 3,
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"material": 0
},
{
"mode": 4,
"indices": 4,
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"material": 1
},
{
"mode": 4,
"indices": 5,
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"material": 2
},
{
"mode": 4,
"indices": 6,
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"material": 3
}
]
}
],
"nodes": [
{
"children": [
1
],
"name": "tmpParent",
"translation": [
0,
0,
0
],
"rotation": [
0,
0,
0,
1
],
"scale": [
1,
1,
1
]
},
{
"name": "craft_speederD",
"translation": [
0,
0,
0
],
"rotation": [
0,
0,
0,
1
],
"scale": [
1,
1,
1
],
"mesh": 0
}
],
"scenes": [
{
"nodes": [
1
]
}
],
"scene": 0
}