usdrt::UsdPhysicsDriveAPI

Defined in usdrt/scenegraph/usd/usdPhysics/driveAPI.h

Functions

Variables

class UsdPhysicsDriveAPI : public usdrt::UsdAPISchemaBase

The PhysicsDriveAPI when applied to any joint primitive will drive the joint towards a given target. The PhysicsDriveAPI is a multipleApply schema: drive can be set per axis “transX”, “transY”, “transZ”, “rotX”, “rotY”, “rotZ” or its “linear” for prismatic joint or “angular” for revolute joints. Setting these as a multipleApply schema TfToken name will define the degree of freedom the DriveAPI is applied to. Each drive is an implicit force-limited damped spring: Force or acceleration = stiffness * (targetPosition - position)

  • damping * (targetVelocity - velocity) For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdPhysicsTokens. So to set an attribute to the value “rightHanded”, use UsdPhysicsTokens->rightHanded as the value.

Public Functions

inline explicit UsdPhysicsDriveAPI(const UsdPrim &prim = UsdPrim(), const TfToken &name = TfToken())

Construct a UsdPhysicsDriveAPI on UsdPrim prim with name name . Equivalent to UsdPhysicsDriveAPI::Get( prim.GetStage(), prim.GetPath().AppendProperty( “drive:name”));.

for a valid prim , but will not immediately throw an error for an invalid prim

inline explicit UsdPhysicsDriveAPI(const UsdSchemaBase &schemaObj, const TfToken &name)

Construct a UsdPhysicsDriveAPI on the prim held by schemaObj with name name . Should be preferred over UsdPhysicsDriveAPI(schemaObj.GetPrim(), name), as it preserves SchemaBase state.

inline virtual ~UsdPhysicsDriveAPI()

Destructor.

inline operator bool() const

Boolean operator.

Returns

Return true if the contained prim is has this api schema applied using HasAPI, and false otherwise.

inline TfToken GetName() const

Returns the name of this multiple-apply schema instance.

inline UsdAttribute GetTypeAttr() const

Drive spring is for the acceleration at the joint (rather than the force).

Declaration

uniform token physics:type = "force"

C++ Type

TfToken

Usd Type

SdfValueTypeNames->Token

Variability

SdfVariabilityUniform

Allowed Values

force, acceleration

inline UsdAttribute CreateTypeAttr() const

See GetTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetMaxForceAttr() const

Maximum force that can be applied to drive. Units: if linear drive: mass*DIST_UNITS/second/second if angular drive: mass*DIST_UNITS*DIST_UNITS/second/second inf means not limited. Must be non-negative.

Declaration

float physics:maxForce = inf

C++ Type

float

Usd Type

SdfValueTypeNames->Float

inline UsdAttribute CreateMaxForceAttr() const

See GetMaxForceAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetTargetPositionAttr() const

Target value for position. Units: if linear drive: distance if angular drive: degrees.

Declaration

float physics:targetPosition = 0

C++ Type

float

Usd Type

SdfValueTypeNames->Float

inline UsdAttribute CreateTargetPositionAttr() const

See GetTargetPositionAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetTargetVelocityAttr() const

Target value for velocity. Units: if linear drive: distance/second if angular drive: degrees/second.

Declaration

float physics:targetVelocity = 0

C++ Type

float

Usd Type

SdfValueTypeNames->Float

inline UsdAttribute CreateTargetVelocityAttr() const

See GetTargetVelocityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetDampingAttr() const

Damping of the drive. Units: if linear drive: mass/second If angular drive: mass*DIST_UNITS*DIST_UNITS/second/second/degrees.

Declaration

float physics:damping = 0

C++ Type

float

Usd Type

SdfValueTypeNames->Float

inline UsdAttribute CreateDampingAttr() const

See GetDampingAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetStiffnessAttr() const

Stiffness of the drive. Units: if linear drive: mass/second/second if angular drive: mass*DIST_UNITS*DIST_UNITS/degree/second/second.

Declaration

float physics:stiffness = 0

C++ Type

float

Usd Type

SdfValueTypeNames->Float

inline UsdAttribute CreateStiffnessAttr() const

See GetStiffnessAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

UsdPrim GetPrim() const

Return this schema object’s held prim.

SdfPath GetPath() const

Return the SdfPath to this schema object’s held prim.

Public Static Functions

static inline UsdPhysicsDriveAPI Apply(const UsdPrim &prim, const TfToken &name)

Applies this multiple-apply API schema to the given prim along with the given instance name, name.

This information is stored by adding “PhysicsDriveAPI:<i>name</i>” to the token-valued, listOp metadata apiSchemas on the prim. For example, if name is ‘instance1’, the token ‘PhysicsDriveAPI:instance1’ is added to ‘apiSchemas’.

See also

UsdPrim::GetAppliedSchemas()

See also

UsdPrim::HasAPI()

See also

UsdPrim::ApplyAPI()

See also

UsdPrim::RemoveAPI()

Returns

A valid UsdPhysicsDriveAPI object is returned upon success. An invalid (or empty) UsdPhysicsDriveAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure.

Public Static Attributes

static const UsdSchemaType schemaType = UsdSchemaType::MultipleApplyAPI

Compile time constant representing what kind of schema this class is.

See also

UsdSchemaType

Protected Functions

inline const TfToken &_GetInstanceName() const

Returns the instance name of the API schema object belonging to a multiple-apply API schema.

The returned instance name will be empty for non-applied and single-apply API schemas.