usdrt::ForceFieldSchemaPhysxForceFieldAPI

Defined in usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldAPI.h

Functions

Variables

class ForceFieldSchemaPhysxForceFieldAPI : public usdrt::UsdAPISchemaBase

Force field base class that simply specifies the position and enables or disables the ForceField.

Public Functions

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

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

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

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

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

inline virtual ~ForceFieldSchemaPhysxForceFieldAPI()

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 GetEnabledAttr() const

Enable or disable this ForceField. Overrides all other settings.

Declaration

bool physxForceField:enabled = 1

C++ Type

bool

Usd Type

SdfValueTypeNames->Bool

inline UsdAttribute CreateEnabledAttr() const

See GetEnabledAttr(), 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 GetSurfaceSampleDensityAttr() const

Number of rays to cast per square unit of surface area. When Surface Sampling is disabled, by setting this value to 0.0, (or when it is enabled and a rigid body has no geometry to sample) all forces act through the Center of Mass of the Rigid Body and no rotational torques will be applied. Any positive value will enable Surface Sampling. Ray casts are performed against the Collision Object of the Rigid Body in order to apply forces on the surface along the direction of the surface normal. This will apply torques to the Rigid Body that will induce rotation. Higher densities will cast more rays over the surface and spread the same force over the surface area. More ray casts will generate more accurate forces and torques, but will take additional compute time.

Declaration

float physxForceField:surfaceSampleDensity = 0

C++ Type

float

Usd Type

SdfValueTypeNames->Float

inline UsdAttribute CreateSurfaceSampleDensityAttr() const

See GetSurfaceSampleDensityAttr(), 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 GetSurfaceAreaScaleEnabledAttr() const

Enable or disable scaling forces by the surface area that faces in the direction of the applied force. If a rigid body has no geometry to sample, the surface area scaling is also disabled for that rigid body. The surface area measurement is an approximation based on the collision object bounding box. Certain forces, like wind and drag increase as the exposed surface area increases, but this may not always be desirable.

Declaration

bool physxForceField:surfaceAreaScaleEnabled = 1

C++ Type

bool

Usd Type

SdfValueTypeNames->Bool

inline UsdAttribute CreateSurfaceAreaScaleEnabledAttr() const

See GetSurfaceAreaScaleEnabledAttr(), 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 GetPositionAttr() const

The location of the force field. Set to (0, 0, 0) to obtain the position from the prim and continuously update it if it is animated.

Declaration

float3 physxForceField:position = (0, 0, 0)

C++ Type

GfVec3f

Usd Type

SdfValueTypeNames->Float3

inline UsdAttribute CreatePositionAttr() const

See GetPositionAttr(), 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 GetRangeAttr() const

Forces are not applied when the distance to the force field is outside of this (minimum, maximum) range. Each force field can have a different definition of distance, e.g. for a spherical fore field, the distance is to the center, for a plane, the distance is to the closest point on the surface, for a line, it is to the closest point on the line. The minimum or maximum range is ignored if the value is negative.

Declaration

float2 physxForceField:range = (-1, -1)

C++ Type

GfVec2f

Usd Type

SdfValueTypeNames->Float2

inline UsdAttribute CreateRangeAttr() const

See GetRangeAttr(), 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 ForceFieldSchemaPhysxForceFieldAPI 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 “PhysxForceFieldAPI:<i>name</i>” to the token-valued, listOp metadata apiSchemas on the prim. For example, if name is ‘instance1’, the token ‘PhysxForceFieldAPI:instance1’ is added to ‘apiSchemas’.

See also

UsdPrim::GetAppliedSchemas()

See also

UsdPrim::HasAPI()

See also

UsdPrim::ApplyAPI()

See also

UsdPrim::RemoveAPI()

Returns

A valid ForceFieldSchemaPhysxForceFieldAPI object is returned upon success. An invalid (or empty) ForceFieldSchemaPhysxForceFieldAPI 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.