Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KHR_physics_rigid_bodies Draft Proposal #2424

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
509 changes: 509 additions & 0 deletions extensions/2.0/Khronos/KHR_physics_rigid_bodies/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
360 changes: 360 additions & 0 deletions extensions/2.0/Khronos/KHR_physics_rigid_bodies/figures/Overview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "node.KHR_physics_rigid_bodies.collider.schema.json",
"title": "KHR_physics_rigid_bodies Node Collider Property",
"type": "object",
"description": "Parameters describing a shape used for collison detection and response.",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"convexHull": {
"type": "boolean",
"description": "Specifies whether the geometry should be used to generate a convex hull.",
"gltf_detailedDescription": "Specifies how the collision shape is generated from the geometry. When this value is false, the collision volume of this shape is determined byt the node or shape property. When this value is true, this shape should be a convex hull generated by the shape or node.",
"default": false
},
"extensions": { },
"extras": { }
},
"oneOf": [
"shape": {
"allOf": [{ "$ref": "glTFid.schema.json" }],
"description": "The index of the shape in the top level shapes array."
},
"node": {
"allOf": [{ "$ref": "glTFid.schema.json" }],
"description": "The index of a node providing mesh geometry."
}
],
"required": [
"shape"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_physics_rigid_bodies.collision_filter.schema.json",
"title": "KHR_physics_rigid_bodies Collision Filter",
"type": "object",
"description": "Parameters describing a parameterization of a collision filter, allowing for disabling collision between pairs of shapes.",
"allOf": [ { "$ref": "glTFChildOfRootProperty.schema.json" } ],
"properties": {
"collisionSystems": {
"type": "array",
"description": "An array of strings representing the names of the collision systems of which this object is a member.",
"items": {
"type": "string"
}
},
"collideWithSystems": {
"type": "array",
"description": "An array of strings representing the name of the collision systems which this object can collide with.",
"items": {
"type": "string"
}
},
"notCollideWithSystems": {
"type": "array",
"description": "An array of strings representing the names of the collision systems which this object does not collide with.",
"items": {
"type": "string"
}
},
"extensions": { },
"extras": { }
},
"not": {
"anyOf": [
{ "required": [ "collideWithSystems", "notCollideWithSystems" ] }
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_physics_rigid_bodies.joint.drive.schema.json",
"title": "KHR_physics_rigid_bodies Physics Joint Drive",
"type": "object",
"description": "Parameters describing a drive or motor which applies forces within a joint.",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"type": {
"description": "Determines the degree of freedom which this drive controls.",
"anyOf": [
{
"const": "linear",
"description": "The drive applies a linear force along the driven axis."
},
{
"const": "angular",
"description": "The drive applies a torque about the driven axis."
},
{
"type": "string"
}
]
},
"mode": {
"description": "Specifies the force calculation mode.",
"anyOf": [
{
"const": "force",
"description": "Value computed from the spring equation is the force to apply along the axis."
},
{
"const": "acceleration",
"description": "Value computed from the spring equation is the acceleration to apply along the axis."
},
{
"type": "string"
}
]
},
"axis": {
"type": "integer",
"minimum": 0,
"maximum": 2,
"description": "The index of the axis which this drive applies forces on."
},
"maxForce": {
"type": "number",
"description": "The maximum force (or torque, for angular drives) the drive can apply. If not provided, this drive is not force-limited.",
"minimum": 0
},
"positionTarget": {
"type": "number",
"description": "The target translation or angle along/about the axis that this drive attempts to achieve."
},
"velocityTarget": {
"type": "number",
"description": "The target linear velocity or angular velocity along/about the axis that this drive attempts to achieve."
},
"stiffness": {
"type": "number",
"description": "The stiffness of the drive, scaling the force based on the position target.",
"default": 0,
"minimum": 0
},
"damping": {
"type": "number",
"description": "The damping of the drive, scaling the force based on the velocity target.",
"default": 0,
"minimum": 0
}
},
"required": [
"type",
"mode",
"axis"
],
"dependencies": {
"positionTarget": [ "stiffness" ],
"stiffness": [ "positionTarget" ],
"velocityTarget": [ "damping" ],
"damping": [ "velocityTarget" ]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_physics_rigid_bodies.joint.limit.schema.json",
"title": "KHR_physics_rigid_bodies Physics Joint Limit",
"type": "object",
"description": "Parameters describing how a joint constrains the relative motion of a pair of nodes.",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"min": {
"type": "number",
"description": "The minimum of the allowed range of relative distance in meters, or angle in radians."
},
"max": {
"type": "number",
"description": "The maximum of the allowed range of relative distance in meters, or angle in radians."
},
"stiffness": {
"type": "number",
"description": "The spring constant used to calculate a restorative force when the joint is extended beyond the limit. If not present, the limit should be infinitely stiff.",
"minimum": 0.0
},
"damping": {
"type": "number",
"description": "Damping applied to the velocity when the joint is extended beyond the limit.",
"minimum": 0.0,
"default": 0.0
},
"extensions": { },
"extras": { }
},
"oneOf": [
{
"type": "object",
"properties": {
"linearAxes": {
"description": "The indices of the linear axes which are limited, constraining the linear motion in 1, 2 or 3 dimensions. 1D keeps an object some distance from an infinite plane. 2D keeps an object some distance from an infinite line. 3D keeps an object some distance from a point. Can only contain 0 (X), 1 (Y), or 2 (Z), so [0, 1, 2] constrains all three axes.",
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 2
},
"minItems": 1,
"maxItems": 3,
"uniqueItems": true
}
},
"required": ["linearAxes"]
},
{
"type": "object",
"properties": {
"angularAxes": {
"description": "The indices of the angular axes which are limited, constraining the angular motion in 1, 2 or 3 dimensions. 1D limits rotation about one axis (e.g. a universal joint). 2D limits rotation about two axes (e.g. a cone). 3D limits rotation about all three axes. Can only contain 0 (X), 1 (Y), or 2 (Z), so [0, 1, 2] constrains all three axes.",
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 2
},
"minItems": 1,
"maxItems": 3,
"uniqueItems": true
}
},
"required": ["angularAxes"]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_physics_rigid_bodies.joint.schema.json",
"title": "KHR_physics_rigid_bodies Physics Joint",
"type": "object",
"description": "Parameters describing a joint, which may constrain or drive the relative motion of a pair of nodes.",
"allOf": [ { "$ref": "glTFChildOfRootProperty.schema.json" } ],
"properties": {
"limits": {
"type": "array",
"description": "The set of limits which constrain relative motion.",
"items": {
"type": "object",
"$ref": "glTF.KHR_physics_rigid_bodies.joint.limit.schema.json"
}
},
"drives": {
"type": "array",
"description": "The set of drives applying forces to this joint.",
"items": {
"type": "object",
"$ref": "glTF.KHR_physics_rigid_bodies.joint.drive.schema.json"
}
},
"extensions": { },
"extras": { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "KHR_physics_rigid_bodies Physics Joint Drive",
"type": "object",
"description": "Parameters describing a drive which applies forces within a joint.",
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
"properties": {
"type": {
"description": "Determines the degree of freedom which this drive controls.",
"anyOf": [
{
"enum": [ "linear" ],
"description": "The drive applies a linear force along the driven axis."
},
{
"enum": [ "angular" ],
"description": "The drive applies a torque about the driven axis."
},
{
"type": "string"
}
]
},
"mode": {
"description": "Specifies the force calculation mode.",
"anyOf": [
{
"enum": [ "force" ],
"description": "Value computed from the spring equation is the force to apply along the axis."
},
{
"enum": [ "acceleration" ],
"description": "Value computed from the spring equation is the acceleration to apply along the axis."
},
{
"type": "string"
}
]
},
"axis": {
"type": "integer",
"minimum": 0,
"maximum": 3,
"description": "The index of the axis which this drive applies forces on."
},
"maxForce": {
"type": "number",
"description": "The maximum force (or torque, for angular drives) the drive can apply. If not provided, this drive is not force-limited.",
"minimum": 0
},
"positionTarget": {
"type": "number",
"description": "The target translation/angle along the axis that this drive attempts to achieve."
},
"velocityTarget": {
"type": "number",
"description": "The target velocity along/about the axis that this drive attempts to achieve."
},
"stiffness": {
"type": "number",
"description": "The stiffness of the drive, scaling the force based on the position target.",
"default": 0,
"minimum": 0
},
"damping": {
"type": "number",
"description": "The damping of the drive, scaling the force based on the velocity target.",
"default": 0,
"minimum": 0
}
],
"required": [
"type",
"mode",
"axis"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "glTF.KHR_physics_rigid_bodies.material.schema.json",
"title": "KHR_physics_rigid_bodies Physics Material",
"type": "object",
"description": "Parameters describing the collision response of a surface in a physics simulation.",
"allOf": [ { "$ref": "glTFChildOfRootProperty.schema.json" } ],
"properties": {
"staticFriction": {
"type": "number",
"description": "The friction used when an object is laying still on a surface. Usually a value from 0 to 1. A value of 0 feels like ice, a value of 1 will make it very hard to get the object moving. Simulations which do not differentiate between static and dynamic friction should use the dynamic friction value.",
"minimum": 0.0,
"default": 0.6
},
"dynamicFriction": {
"type": "number",
"description": "The friction used when already moving. Usually a value from 0 to 1. A value of 0 feels like ice, a value of 1 will make it come to rest very quickly unless a lot of force or gravity pushes the object.",
"minimum": 0.0,
"default": 0.6
},
"restitution": {
"type": "number",
"description": "How bouncy is the surface? A value of 0 will not bounce. A value of 1 will bounce without any loss of energy.",
"minimum": 0.0,
"default": 0.0
},
"frictionCombine": {
"type": "string",
"description": "Determines how friction should be combined when two objects interact.",
"enum": ["average", "minimum", "maximum", "multiply"]
},
"restitutionCombine": {
"type": "string",
"description": "Determines how restitution should be combined when two objects interact.",
"enum": ["average", "minimum", "maximum", "multiply"]
},
"extensions": { },
"extras": { }
}
}
Loading
Loading