BodySetup contains all collision information that is associated with a single asset. 更多...
#include <BodySetup.h>
继承自 UBodySetupCore .
被 USkeletalBodySetup 继承.
Public 成员函数 | |
| ENGINE_API void | AbortPhysicsMeshAsyncCreation () |
| Aborts an async cook that hasn't begun. 更多... | |
| ENGINE_API void | AddCollisionFrom (class UBodySetup *FromSetup) |
| Add collision shapes from another body setup to this one | |
| ENGINE_API void | AddShapesToRigidActor_AssumesLocked (FBodyInstance *OwningInstance, FVector &Scale3D, UPhysicalMaterial *SimpleMaterial, TArray< UPhysicalMaterial * > &ComplexMaterials, TArray< FPhysicalMaterialMaskParams > &ComplexMaterialMasks, const FBodyCollisionData &BodyCollisionData, const FTransform &RelativeTM=FTransform::Identity, TArray< FPhysicsShapeHandle > *NewShapes=NULL) |
| Add the shapes defined by this body setup to the supplied PxRigidBody. | |
| virtual void | BeginDestroy () override |
| Called before destroying the object. 更多... | |
| virtual ENGINE_API float | CalculateMass (const UPrimitiveComponent *Component=nullptr) const |
| Calculates the mass. 更多... | |
| bool | CalcUVAtLocation (const FVector &BodySpaceLocation, int32 FaceIndex, int32 UVChannel, FVector2D &UV) const |
| Given a location in body space, and face index, find the UV of the desired UV channel. 更多... | |
| ENGINE_API void | ClearPhysicsMeshes () |
| Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) | |
| ENGINE_API bool | CreateFromModel (class UModel *InModel, bool bRemoveExisting) |
| Converts a UModel to a set of convex hulls for simplified collision. 更多... | |
| virtual ENGINE_API void | CreatePhysicsMeshes () |
| Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data 更多... | |
| ENGINE_API void | CreatePhysicsMeshesAsync (FOnAsyncPhysicsCookFinished OnAsyncPhysicsCookFinished) |
| Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data async (useful for runtime cooking as it can go wide off the game thread) 更多... | |
| virtual void | FinishDestroy () override |
| Called to finish destroying the object. 更多... | |
| ENGINE_API float | GetClosestPointAndNormal (const FVector &WorldPosition, const FTransform &BodyToWorldTM, FVector &ClosestWorldPosition, FVector &FeatureNormal) const |
| Finds the closest point in the body setup. 更多... | |
| ENGINE_API void | GetCookInfo (FCookBodySetupInfo &OutCookInfo, EPhysXMeshCookFlags InCookFlags) const |
| Generates the information needed for cooking geometry. 更多... | |
| void | GetGeometryDDCKey (FString &OutString) const |
| Generate a string to uniquely describe the state of the geometry in this setup to populate the DDC 更多... | |
| ENGINE_API class UPhysicalMaterial * | GetPhysMaterial () const |
| Returns the physics material used for this body. 更多... | |
| virtual void | GetResourceSizeEx (FResourceSizeEx &CumulativeResourceSize) override |
| Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific). 更多... | |
| ENGINE_API float | GetShortestDistanceToPoint (const FVector &WorldPosition, const FTransform &BodyToWorldTM) const |
| Finds the shortest distance between the body setup and a world position. 更多... | |
| virtual ENGINE_API float | GetVolume (const FVector &Scale) const |
| Returns the volume of this element | |
| virtual ENGINE_API void | InvalidatePhysicsData () |
| Invalidate physics data | |
| virtual void | PostInitProperties () override |
| Called after the C++ constructor and after the properties have been initialized, including those loaded from config. 更多... | |
| virtual void | PostLoad () override |
| Do any object-specific cleanup required immediately after loading an object. 更多... | |
| ENGINE_API void | RemoveSimpleCollision () |
| Clear all simple collision | |
| ENGINE_API void | RescaleSimpleCollision (FVector BuildScale) |
| Rescales simple collision geometry. 更多... | |
| virtual void | Serialize (FArchive &Ar) override |
| Handles reading, writing, and reference collecting using FArchive. 更多... | |
| ENGINE_API void | UpdateTriMeshVertices (const TArray< FVector > &NewPositions) |
| Updates the tri mesh collision with new positions, and refits the BVH to match. 更多... | |
Public 属性 | |
| FVector | BuildScale3D |
| Build scale for this body setup (static mesh settings define this value) | |
| FFormatContainer * | CookedFormatDataOverride |
| Cooked physics data override. 更多... | |
| FBodyInstance | DefaultInstance |
| Default properties of the body instance, copied into objects on instantiation, was URB_BodyInstance | |
| TArray< int32 > | FaceRemap |
| Additional face remap table, if available. 更多... | |
| FBodySetupUVInfo | UVInfo |
| Additional UV info, if available. 更多... | |
BodySetup contains all collision information that is associated with a single asset.
A single BodySetup instance is shared among many BodyInstances so that geometry data is not duplicated. Assets typically implement a GetBodySetup function that is used during physics state creation.
| ENGINE_API void UBodySetup::AbortPhysicsMeshAsyncCreation | ( | ) |
Aborts an async cook that hasn't begun.
See CreatePhysicsMeshesAsync. (Useful for cases where frequent updates at runtime would otherwise cause a backlog)
|
overridevirtual |
Called before destroying the object.
This is called immediately upon deciding to destroy the object, to allow the object to begin an asynchronous cleanup process.
重载 UObject .
|
virtual |
Calculates the mass.
You can pass in the component where additional information is pulled from ( Scale, PhysMaterialOverride )
| bool UBodySetup::CalcUVAtLocation | ( | const FVector & | BodySpaceLocation, |
| int32 | FaceIndex, | ||
| int32 | UVChannel, | ||
| FVector2D & | UV | ||
| ) | const |
Given a location in body space, and face index, find the UV of the desired UV channel.
Note this ONLY works if 'Support UV From Hit Results' is enabled in Physics Settings.
| ENGINE_API bool UBodySetup::CreateFromModel | ( | class UModel * | InModel, |
| bool | bRemoveExisting | ||
| ) |
Converts a UModel to a set of convex hulls for simplified collision.
Any convex elements already in this BodySetup will be destroyed. WARNING: the input model can have no single polygon or set of coplanar polygons which merge to more than FPoly::MAX_VERTICES vertices.
| InModel | The input BSP. |
| bRemoveExisting | If true, clears any pre-existing collision |
|
virtual |
Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data
Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX). Must be called before the BodySetup is destroyed
| ENGINE_API void UBodySetup::CreatePhysicsMeshesAsync | ( | FOnAsyncPhysicsCookFinished | OnAsyncPhysicsCookFinished | ) |
Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data async (useful for runtime cooking as it can go wide off the game thread)
Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX). Must be called before the BodySetup is destroyed NOTE: You cannot use the body setup until this operation is done. You must create the physics state (call CreatePhysicsState, or InitBody, etc..) , this does not automatically update the BodyInstance state for you
|
overridevirtual |
Called to finish destroying the object.
After UObject::FinishDestroy is called, the object's memory should no longer be accessed.
重载 UObject .
| ENGINE_API float UBodySetup::GetClosestPointAndNormal | ( | const FVector & | WorldPosition, |
| const FTransform & | BodyToWorldTM, | ||
| FVector & | ClosestWorldPosition, | ||
| FVector & | FeatureNormal | ||
| ) | const |
Finds the closest point in the body setup.
Input and outputs are given in world space.
| WorldPosition | The point we are trying to get close to |
| BodyToWorldTM | The transform to convert BodySetup into world space |
| ClosestWorldPosition | The closest point on the body setup to WorldPosition |
| FeatureNormal | The normal of the feature associated with ClosestWorldPosition |
NOTE: This function ignores convex and trimesh data
| ENGINE_API void UBodySetup::GetCookInfo | ( | FCookBodySetupInfo & | OutCookInfo, |
| EPhysXMeshCookFlags | InCookFlags | ||
| ) | const |
Generates the information needed for cooking geometry.
| OutCookInfo | Info needed during cooking |
| InCookFlags | Any flags desired for TriMesh cooking |
| void UBodySetup::GetGeometryDDCKey | ( | FString & | OutString | ) | const |
Generate a string to uniquely describe the state of the geometry in this setup to populate the DDC
| OutString | The generated string will be place in this FString |
| ENGINE_API class UPhysicalMaterial * UBodySetup::GetPhysMaterial | ( | ) | const |
Returns the physics material used for this body.
If none, specified, returns the default engine material.
|
overridevirtual |
Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific).
| CumulativeResourceSize | Struct used to count up the cumulative size of the resource as to be displayed to artists/LDs in the Editor. |
重载 UObject .
| ENGINE_API float UBodySetup::GetShortestDistanceToPoint | ( | const FVector & | WorldPosition, |
| const FTransform & | BodyToWorldTM | ||
| ) | const |
Finds the shortest distance between the body setup and a world position.
Input and output are given in world space
| WorldPosition | The point we are trying to get close to |
| BodyToWorldTM | The transform to convert BodySetup into world space |
NOTE: This function ignores convex and trimesh data
|
overridevirtual |
Called after the C++ constructor and after the properties have been initialized, including those loaded from config.
This is called before any serialization or other setup has happened.
重载 UObject .
|
overridevirtual |
Do any object-specific cleanup required immediately after loading an object.
This is not called for newly-created objects, and by default will always execute on the game thread.
重载 UObject .
| ENGINE_API void UBodySetup::RescaleSimpleCollision | ( | FVector | BuildScale | ) |
Rescales simple collision geometry.
Note you must recreate physics meshes after this
| BuildScale | The scale to apply to the geometry |
|
overridevirtual |
Updates the tri mesh collision with new positions, and refits the BVH to match.
This is not a full collision cook, and so you can only safely move positions and not change the structure
| NewPositions | The new mesh positions to use |
| FFormatContainer* UBodySetup::CookedFormatDataOverride |
Cooked physics data override.
This is needed in cases where some other body setup has the cooked data and you don't want to own it or copy it. See per poly skeletal mesh
| TArray<int32> UBodySetup::FaceRemap |
Additional face remap table, if available.
Used for determining face index mapping from collision mesh to static mesh, for use with physical material masks
| FBodySetupUVInfo UBodySetup::UVInfo |
Additional UV info, if available.
Used for determining UV for a line trace impact.