usdrt::UsdPhysicsDriveAPI
Defined in usdrt/scenegraph/usd/usdPhysics/driveAPI.h
-
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 namename
. Equivalent to UsdPhysicsDriveAPI::Get( prim.GetStage(), prim.GetPath().AppendProperty( “drive:name”));.for a valid
prim
, but will not immediately throw an error for an invalidprim
-
inline explicit UsdPhysicsDriveAPI(const UsdSchemaBase &schemaObj, const TfToken &name)
Construct a UsdPhysicsDriveAPI on the prim held by
schemaObj
with namename
. Should be preferred over UsdPhysicsDriveAPI(schemaObj.GetPrim(), name), as it preserves SchemaBase state.
-
inline virtual ~UsdPhysicsDriveAPI()
Destructor.
-
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
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) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
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) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
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) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
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) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
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) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
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) ifwriteSparsely
istrue
- the default forwriteSparsely
isfalse
.
-
inline explicit operator bool() const
Check if this schema object is compatible with it’s held prim and that the prim is valid.
A typed schema object is compatible if the held prim’s type is or is a subtype of the schema’s type. Based on
prim.IsA()
.An API schema object is compatible if the API is of type SingleApplyAPI or UsdSchemaType::MultipleApplyAPI, and the schema has been applied to the prim. Based on
prim.HasAPI
.This method invokes polymorphic behaviour.
See also
- Returns
True if the help prim is valid, and the schema object is compatible with its 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
See also
See also
See also
- 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
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.
-
inline virtual bool _IsCompatible() const
Check whether this APISchema object is valid for the currently held prim.
If this is an applied API schema, this returns true if the held prim is valid and already has the API schema applied to it, along with the instanceName (in the case of multiple-apply). The instanceName should not be empty in the case of a multiple-apply API schema.
This check is performed when clients invoke the explicit bool conversion operator, implemented in UsdSchemaBase.
See also