Loading...
Searching...
No Matches
rigidBodyAPI.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef USDPHYSICS_GENERATED_RIGIDBODYAPI_H
25#define USDPHYSICS_GENERATED_RIGIDBODYAPI_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usdPhysics/api.h"
32#include "pxr/usd/usd/prim.h"
33#include "pxr/usd/usd/stage.h"
35
37#include "pxr/base/gf/quatf.h"
38
39#include "pxr/base/vt/value.h"
40
41#include "pxr/base/gf/vec3d.h"
42#include "pxr/base/gf/vec3f.h"
44
45#include "pxr/base/tf/token.h"
46#include "pxr/base/tf/type.h"
47
48PXR_NAMESPACE_OPEN_SCOPE
49
50class SdfAssetPath;
51
52// -------------------------------------------------------------------------- //
53// PHYSICSRIGIDBODYAPI //
54// -------------------------------------------------------------------------- //
55
64{
65public:
69 static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
70
75 explicit UsdPhysicsRigidBodyAPI(const UsdPrim& prim=UsdPrim())
76 : UsdAPISchemaBase(prim)
77 {
78 }
79
83 explicit UsdPhysicsRigidBodyAPI(const UsdSchemaBase& schemaObj)
84 : UsdAPISchemaBase(schemaObj)
85 {
86 }
87
89 USDPHYSICS_API
91
95 USDPHYSICS_API
96 static const TfTokenVector &
97 GetSchemaAttributeNames(bool includeInherited=true);
98
108 USDPHYSICS_API
110 Get(const UsdStagePtr &stage, const SdfPath &path);
111
112
129 USDPHYSICS_API
130 static bool
131 CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
132
148 USDPHYSICS_API
150 Apply(const UsdPrim &prim);
151
152protected:
156 USDPHYSICS_API
158
159private:
160 // needs to invoke _GetStaticTfType.
161 friend class UsdSchemaRegistry;
162 USDPHYSICS_API
163 static const TfType &_GetStaticTfType();
164
165 static bool _IsTypedSchema();
166
167 // override SchemaBase virtuals.
168 USDPHYSICS_API
169 const TfType &_GetTfType() const override;
170
171public:
172 // --------------------------------------------------------------------- //
173 // RIGIDBODYENABLED
174 // --------------------------------------------------------------------- //
182 USDPHYSICS_API
184
190 USDPHYSICS_API
191 UsdAttribute CreateRigidBodyEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
192
193public:
194 // --------------------------------------------------------------------- //
195 // KINEMATICENABLED
196 // --------------------------------------------------------------------- //
208 USDPHYSICS_API
210
216 USDPHYSICS_API
217 UsdAttribute CreateKinematicEnabledAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
218
219public:
220 // --------------------------------------------------------------------- //
221 // STARTSASLEEP
222 // --------------------------------------------------------------------- //
231 USDPHYSICS_API
233
239 USDPHYSICS_API
240 UsdAttribute CreateStartsAsleepAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
241
242public:
243 // --------------------------------------------------------------------- //
244 // VELOCITY
245 // --------------------------------------------------------------------- //
254 USDPHYSICS_API
256
262 USDPHYSICS_API
263 UsdAttribute CreateVelocityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
264
265public:
266 // --------------------------------------------------------------------- //
267 // ANGULARVELOCITY
268 // --------------------------------------------------------------------- //
277 USDPHYSICS_API
279
285 USDPHYSICS_API
286 UsdAttribute CreateAngularVelocityAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
287
288public:
289 // --------------------------------------------------------------------- //
290 // SIMULATIONOWNER
291 // --------------------------------------------------------------------- //
296 USDPHYSICS_API
298
301 USDPHYSICS_API
303
304public:
305 // ===================================================================== //
306 // Feel free to add custom code below this line, it will be preserved by
307 // the code generator.
308 //
309 // Just remember to:
310 // - Close the class declaration with };
311 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
312 // - Close the include guard with #endif
313 // ===================================================================== //
314 // --(BEGIN CUSTOM CODE)--
315
318 {
319 float volume; //< Collision volume
320 GfMatrix3f inertia; //< Collision inertia
321 GfVec3f centerOfMass; //< Collision center of mass
322 GfVec3f localPos; //< Collision local position with respect to the rigid body
323 GfQuatf localRot; //< Collision local rotation with respect to the rigid body
324 };
325
328 typedef std::function<MassInformationFnSig> MassInformationFn;
329
336 USDPHYSICS_API
337 float ComputeMassProperties(GfVec3f* diagonalInertia, GfVec3f* com, GfQuatf* principalAxes,
338 const MassInformationFn& massInfoFn) const;
339
340};
341
342PXR_NAMESPACE_CLOSE_SCOPE
343
344#endif
Stores a 3x3 matrix of float elements.
Definition: matrix3f.h:82
Basic type: a quaternion, a complex number with a real coefficient and three imaginary coefficients,...
Definition: quatf.h:60
Basic type for a vector of 3 float components.
Definition: vec3f.h:63
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
TfType represents a dynamic runtime type.
Definition: type.h:65
The base class for all API schemas.
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
Applies physics body attributes to any UsdGeomXformable prim and marks that prim to be driven by a si...
Definition: rigidBodyAPI.h:64
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.
MassInformation MassInformationFnSig(const UsdPrim &)
Mass information function signature, for given UsdPrim gather MassInformation.
Definition: rigidBodyAPI.h:327
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: rigidBodyAPI.h:69
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.
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 .
Definition: rigidBodyAPI.h:75
UsdPhysicsRigidBodyAPI(const UsdSchemaBase &schemaObj)
Construct a UsdPhysicsRigidBodyAPI on the prim held by schemaObj .
Definition: rigidBodyAPI.h:83
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.
Definition: rigidBodyAPI.h:318
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
A UsdRelationship creates dependencies between scenegraph objects by allowing a prim to target other ...
Definition: relationship.h:128
The base class for all schema types in Usd.
Definition: schemaBase.h:56
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:164
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:129
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:457