engine
 
载入中...
搜索中...
未找到
Public 成员函数 | Public 属性 | 所有成员列表
UBodySetup类 参考

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.

参见
GetBodySetup
FBodyInstance

成员函数说明

◆ AbortPhysicsMeshAsyncCreation()

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)

◆ BeginDestroy()

virtual void UBodySetup::BeginDestroy ( )
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 .

◆ CalculateMass()

virtual ENGINE_API float UBodySetup::CalculateMass ( const UPrimitiveComponent *  Component = nullptr) const
virtual

Calculates the mass.

You can pass in the component where additional information is pulled from ( Scale, PhysMaterialOverride )

◆ CalcUVAtLocation()

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.

◆ CreateFromModel()

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.

参数
InModelThe input BSP.
bRemoveExistingIf true, clears any pre-existing collision
返回
true on success, false on failure because of vertex count overflow.

◆ CreatePhysicsMeshes()

virtual ENGINE_API void UBodySetup::CreatePhysicsMeshes ( )
virtual

Create Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX) from cooked data

Release Physics meshes (ConvexMeshes, TriMesh & TriMeshNegX). Must be called before the BodySetup is destroyed

◆ CreatePhysicsMeshesAsync()

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

◆ FinishDestroy()

virtual void UBodySetup::FinishDestroy ( )
overridevirtual

Called to finish destroying the object.

After UObject::FinishDestroy is called, the object's memory should no longer be accessed.

警告
Because properties are destroyed here, Super::FinishDestroy() should always be called at the end of your child class's FinishDestroy() method, rather than at the beginning.

重载 UObject .

◆ GetClosestPointAndNormal()

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.

参数
WorldPositionThe point we are trying to get close to
BodyToWorldTMThe transform to convert BodySetup into world space
ClosestWorldPositionThe closest point on the body setup to WorldPosition
FeatureNormalThe normal of the feature associated with ClosestWorldPosition
返回
The distance between WorldPosition and the body setup. 0 indicates WorldPosition is inside one of the shapes.

NOTE: This function ignores convex and trimesh data

◆ GetCookInfo()

ENGINE_API void UBodySetup::GetCookInfo ( FCookBodySetupInfo &  OutCookInfo,
EPhysXMeshCookFlags  InCookFlags 
) const

Generates the information needed for cooking geometry.

参数
OutCookInfoInfo needed during cooking
InCookFlagsAny flags desired for TriMesh cooking

◆ GetGeometryDDCKey()

void UBodySetup::GetGeometryDDCKey ( FString &  OutString) const

Generate a string to uniquely describe the state of the geometry in this setup to populate the DDC

参数
OutStringThe generated string will be place in this FString

◆ GetPhysMaterial()

ENGINE_API class UPhysicalMaterial * UBodySetup::GetPhysMaterial ( ) const

Returns the physics material used for this body.

If none, specified, returns the default engine material.

◆ GetResourceSizeEx()

virtual void UBodySetup::GetResourceSizeEx ( FResourceSizeEx &  CumulativeResourceSize)
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).

参数
CumulativeResourceSizeStruct used to count up the cumulative size of the resource as to be displayed to artists/LDs in the Editor.

重载 UObject .

◆ GetShortestDistanceToPoint()

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

参数
WorldPositionThe point we are trying to get close to
BodyToWorldTMThe transform to convert BodySetup into world space
返回
The distance between WorldPosition and the body setup. 0 indicates WorldPosition is inside one of the shapes.

NOTE: This function ignores convex and trimesh data

◆ PostInitProperties()

virtual void UBodySetup::PostInitProperties ( )
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 .

◆ PostLoad()

virtual void UBodySetup::PostLoad ( )
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 .

◆ RescaleSimpleCollision()

ENGINE_API void UBodySetup::RescaleSimpleCollision ( FVector  BuildScale)

Rescales simple collision geometry.

Note you must recreate physics meshes after this

参数
BuildScaleThe scale to apply to the geometry

◆ Serialize()

virtual void UBodySetup::Serialize ( FArchive &  Ar)
overridevirtual

Handles reading, writing, and reference collecting using FArchive.

This implementation handles all FProperty serialization, but can be overridden for native variables.

重载 UObject .

◆ UpdateTriMeshVertices()

ENGINE_API void UBodySetup::UpdateTriMeshVertices ( const TArray< FVector > &  NewPositions)

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

参数
NewPositionsThe new mesh positions to use

类成员变量说明

◆ CookedFormatDataOverride

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

◆ FaceRemap

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

◆ UVInfo

FBodySetupUVInfo UBodySetup::UVInfo

Additional UV info, if available.

Used for determining UV for a line trace impact.


该类的文档由以下文件生成: