Loading...
Searching...
No Matches
rigidBodyAPI.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef USDPHYSICS_GENERATED_RIGIDBODYAPI_H
8#define USDPHYSICS_GENERATED_RIGIDBODYAPI_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdPhysics/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
18
20#include "pxr/base/gf/quatf.h"
21
22#include "pxr/base/vt/value.h"
23
24#include "pxr/base/gf/vec3d.h"
25#include "pxr/base/gf/vec3f.h"
27
28#include "pxr/base/tf/token.h"
29#include "pxr/base/tf/type.h"
30
31PXR_NAMESPACE_OPEN_SCOPE
32
33class SdfAssetPath;
34
35// -------------------------------------------------------------------------- //
36// PHYSICSRIGIDBODYAPI //
37// -------------------------------------------------------------------------- //
38
49{
50public:
55
60 explicit UsdPhysicsRigidBodyAPI(const UsdPrim& prim=UsdPrim())
61 : UsdAPISchemaBase(prim)
62 {
63 }
64
68 explicit UsdPhysicsRigidBodyAPI(const UsdSchemaBase& schemaObj)
69 : UsdAPISchemaBase(schemaObj)
70 {
71 }
72
74 USDPHYSICS_API
76
80 USDPHYSICS_API
81 static const TfTokenVector &
82 GetSchemaAttributeNames(bool includeInherited=true);
83
93 USDPHYSICS_API
95 Get(const UsdStagePtr &stage, const SdfPath &path);
96
97
114 USDPHYSICS_API
115 static bool
116 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
117
133 USDPHYSICS_API
135 Apply(const UsdPrim &prim);
136
137protected:
141 USDPHYSICS_API
143
144private:
145 // needs to invoke _GetStaticTfType.
146 friend class UsdSchemaRegistry;
147 USDPHYSICS_API
148 static const TfType &_GetStaticTfType();
149
150 static bool _IsTypedSchema();
151
152 // override SchemaBase virtuals.
153 USDPHYSICS_API
154 const TfType &_GetTfType() const override;
155
156public:
157 // --------------------------------------------------------------------- //
158 // RIGIDBODYENABLED
159 // --------------------------------------------------------------------- //
167 USDPHYSICS_API
169
175 USDPHYSICS_API
176 UsdAttribute CreateRigidBodyEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
177
178public:
179 // --------------------------------------------------------------------- //
180 // KINEMATICENABLED
181 // --------------------------------------------------------------------- //
193 USDPHYSICS_API
195
201 USDPHYSICS_API
202 UsdAttribute CreateKinematicEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
203
204public:
205 // --------------------------------------------------------------------- //
206 // STARTSASLEEP
207 // --------------------------------------------------------------------- //
216 USDPHYSICS_API
218
224 USDPHYSICS_API
225 UsdAttribute CreateStartsAsleepAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
226
227public:
228 // --------------------------------------------------------------------- //
229 // VELOCITY
230 // --------------------------------------------------------------------- //
239 USDPHYSICS_API
241
247 USDPHYSICS_API
248 UsdAttribute CreateVelocityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
249
250public:
251 // --------------------------------------------------------------------- //
252 // ANGULARVELOCITY
253 // --------------------------------------------------------------------- //
262 USDPHYSICS_API
264
270 USDPHYSICS_API
271 UsdAttribute CreateAngularVelocityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
272
273public:
274 // --------------------------------------------------------------------- //
275 // SIMULATIONOWNER
276 // --------------------------------------------------------------------- //
281 USDPHYSICS_API
283
286 USDPHYSICS_API
288
289public:
290 // ===================================================================== //
291 // Feel free to add custom code below this line, it will be preserved by
292 // the code generator.
293 //
294 // Just remember to:
295 // - Close the class declaration with };
296 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
297 // - Close the include guard with #endif
298 // ===================================================================== //
299 // --(BEGIN CUSTOM CODE)--
300
303 {
304 float volume; //< Collision volume
305 GfMatrix3f inertia; //< Collision inertia
306 GfVec3f centerOfMass; //< Collision center of mass
307 GfVec3f localPos; //< Collision local position with respect to the rigid body
308 GfQuatf localRot; //< Collision local rotation with respect to the rigid body
309 };
310
313 typedef std::function<MassInformationFnSig> MassInformationFn;
314
321 USDPHYSICS_API
322 float ComputeMassProperties(GfVec3f* diagonalInertia, GfVec3f* com, GfQuatf* principalAxes,
323 const MassInformationFn& massInfoFn) const;
324
325};
326
327PXR_NAMESPACE_CLOSE_SCOPE
328
329#endif
Stores a 3x3 matrix of float elements.
Definition matrix3f.h:65
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Definition quatf.h:43
Basic type for a vector of 3 float components.
Definition vec3f.h:46
Contains an asset path and optional evaluated and resolved paths.
Definition assetPath.h:79
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
TfType represents a dynamic runtime type.
Definition type.h:48
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition attribute.h:183
Applies physics body attributes to any UsdGeomXformable prim and marks that prim to be driven by a si...
static USDPHYSICS_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
USDPHYSICS_API UsdAttribute GetRigidBodyEnabledAttr() const
Determines if this PhysicsRigidBodyAPI is enabled.
USDPHYSICS_API UsdAttribute CreateVelocityAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetVelocityAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
USDPHYSICS_API UsdAttribute CreateAngularVelocityAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetAngularVelocityAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDPHYSICS_API float ComputeMassProperties(GfVec3f *diagonalInertia, GfVec3f *com, GfQuatf *principalAxes, const MassInformationFn &massInfoFn) const
Compute mass properties of the rigid body diagonalInertia Computed diagonal of the inertial tensor fo...
USDPHYSICS_API UsdAttribute CreateRigidBodyEnabledAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetRigidBodyEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDPHYSICS_API UsdRelationship GetSimulationOwnerRel() const
Single PhysicsScene that will simulate this body.
USDPHYSICS_API UsdAttribute CreateStartsAsleepAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetStartsAsleepAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDPHYSICS_API UsdAttribute GetStartsAsleepAttr() const
Determines if the body is asleep when the simulation starts.
virtual USDPHYSICS_API ~UsdPhysicsRigidBodyAPI()
Destructor.
MassInformation MassInformationFnSig(const UsdPrim &)
Mass information function signature, for given UsdPrim gather MassInformation.
static USDPHYSICS_API UsdPhysicsRigidBodyAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdPhysicsRigidBodyAPI holding the prim adhering to this schema at path on stage.
USDPHYSICS_API UsdAttribute CreateKinematicEnabledAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetKinematicEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDPHYSICS_API UsdAttribute GetAngularVelocityAttr() const
Angular velocity in the same space as the node's xform.
static USDPHYSICS_API UsdPhysicsRigidBodyAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
USDPHYSICS_API UsdAttribute GetKinematicEnabledAttr() const
Determines whether the body is kinematic or not.
UsdPhysicsRigidBodyAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdPhysicsRigidBodyAPI on UsdPrim prim .
UsdPhysicsRigidBodyAPI(const UsdSchemaBase &schemaObj)
Construct a UsdPhysicsRigidBodyAPI on the prim held by schemaObj .
static USDPHYSICS_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
USDPHYSICS_API UsdRelationship CreateSimulationOwnerRel() const
See GetSimulationOwnerRel(), and also Create vs Get Property Methods for when to use Get vs Create.
USDPHYSICS_API UsdAttribute GetVelocityAttr() const
Linear velocity in the same space as the node's xform.
USDPHYSICS_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
Mass information for a collision, used in ComputeMassProperties MassInformationFn callback.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition prim.h:117
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
The base class for all schema types in Usd.
Definition schemaBase.h:39
Singleton registry that provides access to schema type information and the prim definitions for regis...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition value.h:90
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition common.h:112
@ SingleApplyAPI
Single Apply API schema.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition token.h:440