Skip to content

Commit 807ce4b

Browse files
committed
Add default values to physics shapes and update formatting
1 parent e7a802c commit 807ce4b

File tree

9 files changed

+51
-32
lines changed

9 files changed

+51
-32
lines changed
-170 Bytes
Loading
-45 Bytes
Loading

extensions/2.0/OMI_physics_shape/README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ The extension must also be added to the glTF's `extensionsUsed` array and becaus
6363

6464
The main data structure `glTF.OMI_physics_shape.shape.schema.json` defines a type property.
6565

66-
| | Type | Description | Default value |
67-
| --------------| ----------- | -------------------------------------------------------------------------- | -------------------- |
68-
| **type** | `string` | The type of the physics shape as a string. | Required, no default |
66+
| | Type | Description | Default value |
67+
| -------- | -------- | ------------------------------------------ | -------------------- |
68+
| **type** | `string` | The type of the physics shape as a string. | Required, no default |
6969

7070
In addition to the type, a key with the same name as the type can be used to define a sub-JSON with the details of the shape. Which sub-properties are allowed depend on which shape type is being used. The possible properties are described in the following table.
7171

72-
| | Type | Description | Default value | Valid on |
73-
| --------------| ----------- | -------------------------------------------------------------------------- | -------------------- | ------------------------- |
74-
| **size** | `number[3]` | The size of the box shape in meters. | [1.0, 1.0, 1.0] | Box |
75-
| **radius** | `number` | The radius of the shape in meters. | 0.5 | Sphere, capsule, cylinder |
76-
| **height** | `number` | The height of the shape in meters. | 2.0 | Capsule, cylinder |
77-
| **mesh** | `number` | The index of the glTF mesh in the document to use as a mesh shape. | -1 | Trimesh, convex |
72+
| | Type | Description | Default value | Valid on |
73+
| ---------------- | ----------- | ------------------------------------------------------------------ | --------------- | ------------------------- |
74+
| **size** | `number[3]` | The size of the box shape in meters. | [1.0, 1.0, 1.0] | Box |
75+
| **radius** | `number` | The radius of the shape in meters. | 0.5 | Sphere, capsule, cylinder |
76+
| **height** | `number` | The height of the shape in meters. | 2.0 | Capsule, cylinder |
77+
| **mesh** | `number` | The index of the glTF mesh in the document to use as a mesh shape. | -1 | Trimesh, convex |
7878

7979
If a key for the type is missing, or a sub-JSON key is missing, implementations should use the default value. A mesh index of -1 means invalid.
8080

@@ -109,7 +109,9 @@ Capsule shapes describe a "pill" shape. They have a `radius` and `height` proper
109109

110110
#### Cylinder
111111

112-
Cylinder shapes describe a "tall circle" shape. They are similar in structure to capsules, they have a `radius` and `height` property. The height is aligned with the node's local vertical axis. If it's desired to align it along a different axis, rotate the glTF node. If the `radius` property is omitted, the default radius is `0.5`, and if the `height` property is omitted, the default height is `2.0`.
112+
Cylinder shapes describe a "tall circle" shape. They are similar in structure to capsules, they have a `radius` and `height` property. If the `radius` property is omitted, the default radius is `0.5`, and if the `height` property is omitted, the default height is `2.0`.
113+
114+
The `height` property of a cylinder describes the total height, the distance between the center of the bottom disc and the center of the top disc. The height is aligned with the node's local vertical axis. If it's desired to align it along a different axis, rotate the glTF node.
113115

114116
The use of cylinder is discouraged if another shape would work well in its place. Cylinders are harder to calculate than boxes, spheres, and capsules. Not all game engines support cylinder shapes. Engines that do not support cylinder shapes should use an approximation, such as a convex hull roughly shaped like a cylinder. Cylinders over twice as tall as they are wide can use another approximation: a convex hull combined with an embedded capsule (to allow for smooth rolling), by copying the cylinder's values into a new capsule shape.
115117

@@ -131,14 +133,14 @@ Avoid using a trimesh shape for most objects, they are the slowest shapes to cal
131133

132134
The following JSON pointers are defined representing mutable properties defined by this extension, for use with the glTF Object Model including extensions such as `KHR_animation_pointer` and `KHR_interactivity`.
133135

134-
| JSON Pointer | Object Model Type |
135-
| --------------------------------------------------------- | ----------------- |
136-
| `/extensions/OMI_physics_shape/shapes/{}/box/size` | `float3` |
137-
| `/extensions/OMI_physics_shape/shapes/{}/sphere/radius` | `float` |
138-
| `/extensions/OMI_physics_shape/shapes/{}/capsule/radius` | `float` |
139-
| `/extensions/OMI_physics_shape/shapes/{}/capsule/height` | `float` |
140-
| `/extensions/OMI_physics_shape/shapes/{}/cylinder/radius` | `float` |
141-
| `/extensions/OMI_physics_shape/shapes/{}/cylinder/height` | `float` |
136+
| JSON Pointer | Object Model Type |
137+
| --------------------------------------------------------------- | ----------------- |
138+
| `/extensions/OMI_physics_shape/shapes/{}/box/size` | `float3` |
139+
| `/extensions/OMI_physics_shape/shapes/{}/sphere/radius` | `float` |
140+
| `/extensions/OMI_physics_shape/shapes/{}/capsule/height` | `float` |
141+
| `/extensions/OMI_physics_shape/shapes/{}/capsule/radius` | `float` |
142+
| `/extensions/OMI_physics_shape/shapes/{}/cylinder/height` | `float` |
143+
| `/extensions/OMI_physics_shape/shapes/{}/cylinder/radius` | `float` |
142144

143145
Additionally, the following JSON pointers are defined for read-only properties:
144146

extensions/2.0/OMI_physics_shape/schema/glTF.OMI_physics_shape.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"properties": {
99
"shapes": {
1010
"type": "array",
11-
"description": "An array of shapes that can be referenced by nodes.",
11+
"description": "An array of physics shape resources that can be referenced by nodes.",
1212
"items": {
1313
"type": "object",
14-
"$ref": "shape.schema.json"
14+
"$ref": "glTF.OMI_physics_shape.shape.schema.json"
1515
},
1616
"minItems": 1
1717
},

extensions/2.0/OMI_physics_shape/schema/glTF.OMI_physics_shape.shape.box.schema.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
"properties": {
99
"size": {
1010
"type": "array",
11-
"description": "Three number array representing the width, height, and depth of the box (x, y, z)."
11+
"description": "Three number array representing the width, height, and depth of the box (x, y, z).",
12+
"items": {
13+
"type": "number",
14+
"exclusiveMinimum": 0.0
15+
},
16+
"minItems": 3,
17+
"maxItems": 3,
18+
"default": [ 1.0, 1.0, 1.0 ]
1219
},
1320
"extensions": { },
1421
"extras": { }

extensions/2.0/OMI_physics_shape/schema/glTF.OMI_physics_shape.shape.capsule.schema.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
"description": "Parameters describing a capsule physics shape.",
77
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
88
"properties": {
9-
"radius": {
9+
"height": {
1010
"type": "number",
11-
"description": "The radius to use for the capsule shape."
11+
"description": "The full height of the capsule shape in meters.",
12+
"exclusiveMinimum": 0.0,
13+
"default": 2.0
1214
},
13-
"height": {
15+
"radius": {
1416
"type": "number",
15-
"description": "The full height of the capsule shape."
17+
"description": "The radius of the capsule in meters.",
18+
"minimum": 0.0,
19+
"default": 0.5
1620
},
1721
"extensions": { },
1822
"extras": { }

extensions/2.0/OMI_physics_shape/schema/glTF.OMI_physics_shape.shape.cylinder.schema.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
"description": "Parameters describing a cylinder physics shape.",
77
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
88
"properties": {
9-
"radius": {
9+
"height": {
1010
"type": "number",
11-
"description": "The radius to use for the cylinder shape."
11+
"description": "The full height of the cylinder shape in meters, the distance between the centers of the two capping discs.",
12+
"exclusiveMinimum": 0.0,
13+
"default": 2.0
1214
},
13-
"height": {
15+
"radius": {
1416
"type": "number",
15-
"description": "The height of the cylinder shape."
17+
"description": "The radius of the cylinder in meters.",
18+
"minimum": 0.0,
19+
"default": 0.5
1620
},
1721
"extensions": { },
1822
"extras": { }

extensions/2.0/OMI_physics_shape/schema/glTF.OMI_physics_shape.shape.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"$id": "glTF.OMI_physics_shape.shape.schema.json",
44
"title": "OMI_physics_shape Shape Resource",
55
"type": "object",
6-
"description": "Defines a physics shape resource.",
6+
"description": "Defines a physics shape resource that can be referenced by nodes.",
77
"allOf": [ { "$ref": "glTFChildOfRootProperty.schema.json" } ],
88
"properties": {
99
"type": {
1010
"type": "string",
11-
"description": "The type of shape this node represents.",
11+
"description": "Specifies the shape type of this physics shape.",
1212
"enum": [
1313
"box",
1414
"sphere",

extensions/2.0/OMI_physics_shape/schema/glTF.OMI_physics_shape.shape.sphere.schema.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"properties": {
99
"radius": {
1010
"type": "number",
11-
"description": "The radius to use for the sphere shape."
11+
"description": "The radius to use for the sphere shape in meters.",
12+
"minimum": 0.0,
13+
"default": 0.5
1214
},
1315
"extensions": { },
1416
"extras": { }

0 commit comments

Comments
 (0)