Container for a physics representation of an object 更多...
#include <BodyInstance.h>
继承自 FBodyInstanceCore .
Public 成员函数 | |
| void | AddAngularImpulseInRadians (const FVector &Impulse, bool bVelChange) |
| Add a rotational impulse to this body | |
| void | AddCustomPhysics (FCalculateCustomPhysics &CalculateCustomPhysics) |
| Add custom forces and torques on the body. 更多... | |
| void | AddForce (const FVector &Force, bool bAllowSubstepping=true, bool bAccelChange=false) |
| Add a force to this body | |
| void | AddForceAtPosition (const FVector &Force, const FVector &Position, bool bAllowSubstepping=true, bool bIsLocalForce=false) |
| Add a force at a particular position (world space when bIsLocalForce = false, body space otherwise) | |
| void | AddImpulse (const FVector &Impulse, bool bVelChange) |
| Add an impulse to this body | |
| void | AddImpulseAtPosition (const FVector &Impulse, const FVector &Position) |
| Add an impulse to this body and a particular world position | |
| void | AddRadialForceToBody (const FVector &Origin, float Radius, float Strength, uint8 Falloff, bool bAccelChange=false, bool bAllowSubstepping=true) |
| Add a force to this bodyinstance, originating from the supplied world-space location. 更多... | |
| void | AddRadialImpulseToBody (const FVector &Origin, float Radius, float Strength, uint8 Falloff, bool bVelChange=false) |
| Add an impulse to this bodyinstance, radiating out from the specified position. 更多... | |
| void | AddTorqueInRadians (const FVector &Torque, bool bAllowSubstepping=true, bool bAccelChange=false) |
| Add a torque to this body | |
| void | ApplyDeferredCollisionProfileName () |
| Applies a deferred collision profile | |
| void | ApplyMaterialToInstanceShapes_AssumesLocked (UPhysicalMaterial *SimplePhysMat, TArray< UPhysicalMaterial * > &ComplexPhysMats, const TArrayView< FPhysicalMaterialMaskParams > &ComplexPhysMatMasks) |
| Note: This function is not thread safe. 更多... | |
| void | ApplyWeldOnChildren () |
| Finds all children that are technically welded to us (for example kinematics are welded but not as far as physx is concerned) and apply the actual physics engine weld on them | |
| void | BuildBodyFilterData (FBodyCollisionFilterData &OutFilterData, const int32 ShapeIndex=INDEX_NONE) const |
| Build the sim and query filter data (for simple and complex shapes) based on the settings of this BodyInstance (and its associated BodySetup) | |
| void | ClearForces (bool bAllowSubstepping=true) |
| Clear accumulated forces on this body | |
| void | ClearTorques (bool bAllowSubstepping=true) |
| Clear accumulated torques on this body | |
| void | CopyBodyInstancePropertiesFrom (const FBodyInstance *FromInst) |
| Utility for copying properties from one BodyInstance to another. | |
| void | CopyRuntimeBodyInstancePropertiesFrom (const FBodyInstance *FromInst) |
| Utility for copying only the runtime instanced properties from one BodyInstance to another. | |
| bool | DoesUseCollisionProfile () const |
| return true if it uses Collision Profile System. 更多... | |
| void | DrawCOMPosition (class FPrimitiveDrawInterface *PDI, float COMRenderSize, const FColor &COMRenderColor) |
| Draws the center of mass as a wire star | |
| void | ExecuteOnCalculateCustomProjection (FTransform &WorldTM) const |
| Executes the OnCalculateCustomProjection delegate if bound. | |
| FBodyInstance () | |
| Constructor | |
| void | FixupData (class UObject *Loader) |
| UObject notification by OwningComponent | |
| int32 | GetAllShapes_AssumesLocked (TArray< FPhysicsShapeHandle > &OutShapes) const |
| Utility to get all the shapes from a FBodyInstance NOTE: This function is not thread safe. 更多... | |
| FBox | GetBodyBounds () const |
| Return bounds of physics representation | |
| FString | GetBodyDebugName () const |
| Get the name for this body, for use in debugging | |
| FVector | GetBodyInertiaTensor () const |
| Return the body's inertia tensor. 更多... | |
| void | GetBodyInstanceResourceSizeEx (FResourceSizeEx &CumulativeResourceSize) const |
| Returns memory used by resources allocated for this body instance ( ex. 更多... | |
| float | GetBodyMass () const |
| Returns the body's mass | |
| FORCEINLINE ECollisionEnabled::Type | GetCollisionEnabled (bool bCheckOwner=true) const |
| Get the current type of collision enabled | |
| FName | GetCollisionProfileName () const |
| Returns the collision profile name that will be used. | |
| TArray< UPhysicalMaterial * > | GetComplexPhysicalMaterials () const |
| Get the complex PhysicalMaterials array for this body | |
| TArray< UPhysicalMaterial * > | GetComplexPhysicalMaterials (TArray< FPhysicalMaterialMaskParams > &OutPhysMaterialMasks) const |
| Get the complex PhysicalMaterials and PhysicalMaterialMasks array for this body | |
| void | GetComplexPhysicalMaterials (TArray< UPhysicalMaterial * > &OutPhysMaterials) const |
| Get the complex PhysicalMaterials for this body | |
| void | GetComplexPhysicalMaterials (TArray< UPhysicalMaterial * > &OutPhysMaterials, TArray< FPhysicalMaterialMaskParams > &OutPhysMaterialMasks) const |
| Get the complex PhysicalMaterials and PhysicalMaterialMasks for this body | |
| FVector | GetCOMPosition () const |
| Returns the center of mass of this body (in world space) | |
| float | GetDistanceToBody (const FVector &Point, FVector &OutPointOnBody) const |
| Get the square of the distance to the body surface if available It is only valid if BodyShape is convex If point is inside or shape is not convex, it will return 0.f 更多... | |
| FVector | GetLockedAxis () const |
| [Physx Only] | |
| FORCEINLINE FMaskFilter | GetMaskFilter () const |
| Return the ignore mask filter. | |
| float | GetMassOverride () const |
| Returns the mass override. 更多... | |
| FTransform | GetMassSpaceLocal () const |
| Returns the mass coordinate system to local space transform (position is local center of mass, rotation should be identity) | |
| FTransform | GetMassSpaceToWorldSpace () const |
| Returns the mass coordinate system to world space transform (position is world center of mass, rotation is world inertia orientation) | |
| float | GetMaxAngularVelocityInRadians () const |
| Get the maximum angular velocity of this body | |
| FORCEINLINE_DEBUGGABLE ECollisionChannel | GetObjectType () const |
| Get the movement channel of this body | |
| const FBodyInstance * | GetOriginalBodyInstance (const FPhysicsShapeHandle &InShape) const |
| Returns the original owning body instance. 更多... | |
| bool | GetOverrideWalkableSlopeOnInstance () const |
| Gets bOverrideWalkableSlopeOnInstance | |
| FPhysScene * | GetPhysicsScene () |
| Get the scene that owns this body. | |
| const FTransform & | GetRelativeBodyTransform (const FPhysicsShapeHandle &InShape) const |
| Returns the relative transform between root body and welded instance owned by the shape. | |
| FORCEINLINE_DEBUGGABLE ECollisionResponse | GetResponseToChannel (ECollisionChannel Channel) const |
| Get the collision response of this body to a particular channel | |
| FORCEINLINE_DEBUGGABLE const FCollisionResponseContainer & | GetResponseToChannels () const |
| Get Collision ResponseToChannels container for this component | |
| ECollisionEnabled::Type | GetShapeCollisionEnabled (const int32 ShapeIndex) const |
| Get the current type of collision enabled for a particular shape | |
| const FCollisionResponseContainer & | GetShapeResponseToChannels (const int32 ShapeIndex) const |
| Get Collision ResponseToChannels container for a specific shape in this component | |
| UPhysicalMaterial * | GetSimplePhysicalMaterial () const |
| Find the correct PhysicalMaterial for simple geometry on this body | |
| float | GetSleepThresholdMultiplier () const |
| Gets the multiplier to the threshold where the body will go to sleep automatically. | |
| bool | GetSquaredDistanceToBody (const FVector &Point, float &OutDistanceSquared, FVector &OutPointOnBody) const |
| Get distance to the body surface if available It is only valid if BodyShape is convex If point is inside distance it will be 0 Returns false if geometry is not supported 更多... | |
| FVector | GetUnrealWorldAngularVelocityInRadians () const |
| Get current angular velocity in world space from physics body. | |
| FVector | GetUnrealWorldAngularVelocityInRadians_AssumesLocked () const |
| Get current angular velocity in world space from physics body. | |
| FTransform | GetUnrealWorldTransform (bool bWithProjection=true, bool bForceGlobalPose=false) const |
| Get current transform in world space from physics body. | |
| FTransform | GetUnrealWorldTransform_AssumesLocked (bool bWithProjection=true, bool bForceGlobalPose=false) const |
| Get current transform in world space from physics body. | |
| FVector | GetUnrealWorldVelocity () const |
| Get current velocity in world space from physics body. | |
| FVector | GetUnrealWorldVelocity_AssumesLocked () const |
| Get current velocity in world space from physics body. | |
| FVector | GetUnrealWorldVelocityAtPoint (const FVector &Point) const |
| Get current velocity of a point on this physics body, in world space. 更多... | |
| FVector | GetUnrealWorldVelocityAtPoint_AssumesLocked (const FVector &Point) const |
| Get current velocity of a point on this physics body, in world space. 更多... | |
| const struct FWalkableSlopeOverride & | GetWalkableSlopeOverride () const |
| Returns the slope override struct for this instance. 更多... | |
| void | InitBody (UBodySetup *Setup, const FTransform &Transform, UPrimitiveComponent *PrimComp, FPhysScene *InRBScene, const FInitBodySpawnParams &SpawnParams) |
| Initialise a single rigid body (this FBodyInstance) for the given body setup 更多... | |
| void | InitDynamicProperties_AssumesLocked () |
| Initialise dynamic properties for this instance when using physics - this must be done after scene addition. 更多... | |
| bool | IsDynamic () const |
| Returns true if the body is not static | |
| bool | IsInstanceAwake () const |
| Returns whether this body is awake | |
| bool | IsInstanceSimulatingPhysics () const |
| Returns true if this body is simulating, false if it is fixed (kinematic) | |
| bool | IsNonKinematic () const |
| Returns true if the body is non kinematic | |
| bool | IsShapeBoundToBody (const FPhysicsShapeHandle &Shape) const |
| Check if the shape is owned by this body instance | |
| bool | IsValidBodyInstance () const |
| See if this body is valid. | |
| bool | LineTrace (struct FHitResult &OutHit, const FVector &Start, const FVector &End, bool bTraceComplex, bool bReturnPhysicalMaterial=false) const |
| Trace a ray against just this bodyinstance 更多... | |
| void | LoadProfileData (bool bVerifyProfile) |
| Update profile data if required 更多... | |
| FCalculateCustomProjection & | OnCalculateCustomProjection () |
| Returns reference to the OnCalculateCustomProjection delegate. 更多... | |
| FRecalculatedMassProperties & | OnRecalculatedMassProperties () |
| Returns reference to the OnRecalculatedMassProperties delegate. 更多... | |
| bool | OverlapMulti (TArray< struct FOverlapResult > &InOutOverlaps, const class UWorld *World, const FTransform *pWorldToComponent, const FVector &Pos, const FQuat &Rot, ECollisionChannel TestChannel, const struct FComponentQueryParams &Params, const struct FCollisionResponseParams &ResponseParams, const FCollisionObjectQueryParams &ObjectQueryParams=FCollisionObjectQueryParams::DefaultObjectQueryParam) const |
| Determines the set of components that this body instance would overlap with at the supplied location/rotation 更多... | |
| bool | OverlapTest (const FVector &Position, const FQuat &Rotation, const struct FCollisionShape &CollisionShape, FMTDResult *OutMTD=nullptr) const |
| Test if the bodyinstance overlaps with the specified shape at the specified position/rotation 更多... | |
| bool | OverlapTest_AssumesLocked (const FVector &Position, const FQuat &Rotation, const struct FCollisionShape &CollisionShape, FMTDResult *OutMTD=nullptr) const |
| Test if the bodyinstance overlaps with the specified shape at the specified position/rotation Note: This function is not thread safe. 更多... | |
| bool | OverlapTestForBodies (const FVector &Position, const FQuat &Rotation, const TArray< FBodyInstance * > &Bodies) const |
| Test if the bodyinstance overlaps with the specified body instances 更多... | |
| void | PostShapeChange () |
| After adding/removing shapes call this function to update mass distribution etc... | |
| void | PutInstanceToSleep () |
| Force this body to sleep | |
| bool | ReplaceResponseToChannels (ECollisionResponse OldResponse, ECollisionResponse NewResponse) |
| Replace the channels on this body matching the old response with the new response | |
| void | SetAngularVelocityInRadians (const FVector &NewAngVel, bool bAddToCurrent, bool bAutoWake=true) |
| Set the angular velocity of this body | |
| void | SetBodyTransform (const FTransform &NewTransform, ETeleportType Teleport, bool bAutoWake=true) |
| Move the physics body to a new pose. 更多... | |
| void | SetCollisionEnabled (ECollisionEnabled::Type NewType, bool bUpdatePhysicsFilterData=true) |
| Controls what kind of collision is enabled for this body and allows optional disable physics rebuild | |
| void | SetCollisionProfileName (FName InCollisionProfileName) |
| Set Collision Profile Name This function should be called outside of constructors to set profile name. 更多... | |
| void | SetCollisionProfileNameDeferred (FName InCollisionProfileName) |
| Set Collision Profile Name (deferred) This function is called by constructors when they set ProfileName This will change current CollisionProfileName, but collision data will not be set up until the physics state is created or the collision profile is accessed. 更多... | |
| void | SetContactModification (bool bNewContactModification) |
| Enables/disables contact modification | |
| void | SetContactReportForceThreshold (float Threshold) |
| Set a new contact report force threhold. 更多... | |
| void | SetDOFLock (EDOFMode::Type NewDOFMode) |
| [Physx Only] Locks physical movement along axis. | |
| void | SetEnableGravity (bool bGravityEnabled) |
| Enables/disables whether this body is affected by gravity. | |
| void | SetInstanceNotifyRBCollision (bool bNewNotifyCollision) |
| Set whether we should get a notification about physics collisions | |
| void | SetInstanceSimulatePhysics (bool bSimulate, bool bMaintainPhysicsBlending=false) |
| Set this body to be fixed (kinematic) or not. | |
| void | SetLinearVelocity (const FVector &NewVel, bool bAddToCurrent, bool bAutoWake=true) |
| Set the linear velocity of this body | |
| void | SetMaskFilter (FMaskFilter InMaskFilter) |
| Updates the mask filter. | |
| void | SetMassOverride (float MassInKG, bool bNewOverrideMass=true) |
| Sets the mass override | |
| void | SetMassScale (float InMassScale=1.f) |
| Modify the mass scale of this body | |
| void | SetMassSpaceLocal (const FTransform &NewMassSpaceLocalTM) |
| TODO: this only works at runtime when the physics state has been created. 更多... | |
| void | SetMaxAngularVelocityInRadians (float NewMaxAngVel, bool bAddToCurrent, bool bUpdateOverrideMaxAngularVelocity=true) |
| Set the maximum angular velocity of this body | |
| void | SetMaxDepenetrationVelocity (float MaxVelocity) |
| Set the maximum depenetration velocity the physics simulation will introduce | |
| void | SetObjectType (ECollisionChannel Channel) |
| Set the movement channel of this body to the one supplied | |
| void | SetPhysMaterialOverride (class UPhysicalMaterial *NewPhysMaterial) |
| Set physical material override for this body | |
| bool | SetResponseToAllChannels (ECollisionResponse NewResponse) |
| Set the response of this body to all channels | |
| bool | SetResponseToChannel (ECollisionChannel Channel, ECollisionResponse NewResponse) |
| Set the collision response of this body to a particular channel | |
| bool | SetResponseToChannels (const FCollisionResponseContainer &NewResponses) |
| Set the response of this body to the supplied settings | |
| void | SetShapeCollisionEnabled (const int32 ShapeIndex, ECollisionEnabled::Type NewType, bool bUpdatePhysicsFilterData=true) |
| Controls what kind of collision is enabled for a particular shape | |
| bool | SetShapeResponseToChannels (const int32 ShapeIndex, const FCollisionResponseContainer &NewResponses) |
| Set the response of a specific shape on this body to the supplied settings | |
| void | SetUseCCD (bool bInUseCCD) |
| Enable/disable Continuous Collidion Detection feature | |
| void | SetWalkableSlopeOverride (const FWalkableSlopeOverride &NewOverride, bool bNewOverideSetting=true) |
| Sets a custom slope override struct for this instance. 更多... | |
| bool | ShouldInterpolateWhenSubStepping () const |
| Whether we should interpolate when substepping. 更多... | |
| bool | Sweep (struct FHitResult &OutHit, const FVector &Start, const FVector &End, const FQuat &ShapeWorldRotation, const FCollisionShape &Shape, bool bTraceComplex) const |
| Trace a shape against just this bodyinstance 更多... | |
| void | TermBody (bool bNeverDeferRelease=false) |
| Terminates the body, releasing resources 更多... | |
| void | UnWeld (FBodyInstance *Body) |
| Takes a welded body and unwelds it. 更多... | |
| bool | UpdateBodyScale (const FVector &InScale3D, bool bForceUpdate=false) |
| Update Body Scale 更多... | |
| void | UpdateDampingProperties () |
| Update instance's linear and angular damping | |
| void | UpdateInstanceSimulatePhysics () |
| Makes sure the current kinematic state matches the simulate flag | |
| void | UpdateMassProperties () |
| Update instance's mass properties (mass, inertia and center-of-mass offset) based on MassScale, InstanceMassScale and COMNudge. | |
| void | UpdatePhysicalMaterials () |
| Update the instance's material properties (friction, restitution) | |
| void | UpdatePhysicsFilterData () |
| Update the instances collision filtering data | |
| void | UpdateTriMeshVertices (const TArray< FVector > &NewPositions) |
| Dynamically update the vertices of per-poly collision for this body. | |
| void | UseExternalCollisionProfile (UBodySetup *InExternalCollisionProfileBodySetup) |
| Use the collision profile found in the given BodySetup's default BodyInstance | |
| void | WakeInstance () |
| Wake this body | |
| bool | Weld (FBodyInstance *Body, const FTransform &RelativeTM) |
| Takes two body instances and welds them together to create a single simulated rigid body. 更多... | |
静态 Public 成员函数 | |
| static void | ApplyMaterialToShape_AssumesLocked (const FPhysicsShapeHandle &InShape, UPhysicalMaterial *SimplePhysMat, const TArrayView< UPhysicalMaterial * > &ComplexPhysMats, const TArrayView< FPhysicalMaterialMaskParams > *ComplexPhysMatMasks=nullptr) |
| Apply a material directly to the passed in shape. 更多... | |
| static void | BuildBodyCollisionFlags (FBodyCollisionFlags &OutFlags, ECollisionEnabled::Type UseCollisionEnabled, bool bUseComplexAsSimple) |
| Build the flags to control which types of collision (sim and query) shapes owned by this BodyInstance should have. | |
| static void | GetComplexPhysicalMaterials (const FBodyInstance *BodyInstance, TWeakObjectPtr< UPrimitiveComponent > Owner, TArray< UPhysicalMaterial * > &OutPhysMaterials, TArray< FPhysicalMaterialMaskParams > *OutPhysMaterialMasks=nullptr) |
| Find the correct PhysicalMaterial and PhysicalMaterialMasks for complex geometry on a given body and owner. 更多... | |
| static UPhysicalMaterial * | GetSimplePhysicalMaterial (const FBodyInstance *BodyInstance, TWeakObjectPtr< UPrimitiveComponent > Owner, TWeakObjectPtr< UBodySetup > BodySetupPtr) |
| Find the correct PhysicalMaterial for simple geometry on a given body and owner. 更多... | |
| static void | InitStaticBodies (const TArray< FBodyInstance * > &Bodies, const TArray< FTransform > &Transforms, UBodySetup *BodySetup, class UPrimitiveComponent *PrimitiveComp, FPhysScene *InRBScene) |
| Standalone path to batch initialize large amounts of static bodies, which will be deferred till the next scene update for fast scene addition. 更多... | |
| static bool | ValidateTransform (const FTransform &Transform, const FString &DebugName, const UBodySetup *Setup) |
| Validate a body transform, outputting debug info 更多... | |
Public 属性 | |
| float | AngularDamping |
| 'Drag' force added to reduce angular movement | |
| uint8 | bContactModification: 1 |
| Enable contact modification. 更多... | |
| uint8 | bHACK_DisableCollisionResponse: 1 |
| @HACK: These are ONLY used when the 'p.EnableDynamicPerBodyFilterHacks' CVar is set (disabled by default). 更多... | |
| uint8 | bIgnoreAnalyticCollisions: 1 |
| If true ignore analytic collisions and treat objects as a general implicit surface | |
| uint8 | bLockRotation: 1 |
| [Physx Only] When a Locked Axis Mode is selected, will lock rotation to the specified axis | |
| uint8 | bLockTranslation: 1 |
| [Physx Only] When a Locked Axis Mode is selected, will lock translation on the specified axis | |
| uint8 | bLockXRotation: 1 |
| [Physx Only] Lock rotation about the X-axis | |
| uint8 | bLockXTranslation: 1 |
| [Physx Only] Lock translation along the X-axis | |
| uint8 | bLockYRotation: 1 |
| [Physx Only] Lock rotation about the Y-axis | |
| uint8 | bLockYTranslation: 1 |
| [Physx Only] Lock translation along the Y-axis | |
| uint8 | bLockZRotation: 1 |
| [Physx Only] Lock rotation about the Z-axis | |
| uint8 | bLockZTranslation: 1 |
| [Physx Only] Lock translation along the Z-axis | |
| uint8 | bNotifyRigidBodyCollision: 1 |
| Should 'Hit' events fire when this object collides during physics simulation. | |
| uint8 | bOverrideMaxAngularVelocity: 1 |
| Override the default max angular velocity | |
| uint8 | bUseCCD: 1 |
| If true Continuous Collision Detection (CCD) will be used for this component | |
| FVector | COMNudge |
| User specified offset for the center of mass of this object, from the calculated location | |
| FVector | CustomDOFPlaneNormal |
| Locks physical movement along a custom plane for a given normal. | |
| float | CustomSleepThresholdMultiplier |
| If the SleepFamily is set to custom, multiply the natural sleep threshold by this amount. 更多... | |
| FConstraintInstance * | DOFConstraint |
| [Physx Only] Constraint used to allow for easy DOF setup per bodyinstance | |
| TEnumAsByte< EDOFMode::Type > | DOFMode |
| [Physx Only] Locks physical movement along specified axis. | |
| FVector | InertiaTensorScale |
| Per-instance scaling of inertia (bigger number means it'll be harder to rotate) | |
| int32 | InstanceBodyIndex |
| Index of this BodyInstance within the SkeletalMeshComponent/PhysicsAsset. 更多... | |
| int16 | InstanceBoneIndex |
| When we are a body within a SkeletalMeshComponent, we cache the index of the bone we represent, to speed up sync'ing physics to anim. | |
| float | LinearDamping |
| 'Drag' force added to reduce linear movement | |
| float | MassScale |
| Per-instance scaling of mass | |
| float | MaxAngularVelocity |
| The maximum angular velocity for this instance [degrees/s] | |
| TWeakObjectPtr< class UPrimitiveComponent > | OwnerComponent |
| PrimitiveComponent containing this body. 更多... | |
| float | PhysicsBlendWeight |
| Influence of rigid body physics (blending) on the mesh's pose (0.0 == use only animation, 1.0 == use only physics) 更多... | |
| uint8 | PositionSolverIterationCount |
| [PhysX Only] This physics body's solver iteration count for position. 更多... | |
| FVector | Scale3D |
| Current scale of physics - used to know when and how physics must be rescaled to match current transform of OwnerComponent. | |
| ESleepFamily | SleepFamily |
| The set of values used in considering when put this body to sleep. | |
| float | StabilizationThresholdMultiplier |
| Stabilization factor for this body if Physics stabilization is enabled. 更多... | |
| uint8 | VelocitySolverIterationCount |
| [PhysX Only] This physics body's solver iteration count for velocity. 更多... | |
| FBodyInstance * | WeldParent |
| The parent body that we are welded to | |
Protected 成员函数 | |
| void | UpdateInterpolateWhenSubStepping () |
| Update the substepping interpolation flag | |
Protected 属性 | |
| uint8 | bInterpolateWhenSubStepping: 1 |
| Internal flag to allow us to quickly check whether we should interpolate when substepping e.g. 更多... | |
| uint8 | bOverrideMaxDepenetrationVelocity: 1 |
| [PhysX Only] Whether this body instance has its own custom MaxDepenetrationVelocity | |
| uint8 | bOverrideWalkableSlopeOnInstance: 1 |
| Whether this instance of the object has its own custom walkable slope override setting. | |
| uint8 | bPendingCollisionProfileSetup: 1 |
| Whether we are pending a collision profile setup | |
| TWeakObjectPtr< UBodySetup > | ExternalCollisionProfileBodySetup |
| The body setup holding the default body instance and its collision profile. | |
| float | MassInKgOverride |
| Mass of the body in KG. 更多... | |
| float | MaxDepenetrationVelocity |
| [PhysX Only] The maximum velocity used to depenetrate this object | |
| class UPhysicalMaterial * | PhysMaterialOverride |
| Allows you to override the PhysicalMaterial to use for simple collision on this body. | |
| struct FWalkableSlopeOverride | WalkableSlopeOverride |
| Custom walkable slope override setting for this instance. 更多... | |
友元 | |
| class | UCollisionProfile |
| class | UPhysicsAsset |
Container for a physics representation of an object
| void FBodyInstance::AddCustomPhysics | ( | FCalculateCustomPhysics & | CalculateCustomPhysics | ) |
Add custom forces and torques on the body.
The callback will be called more than once, if substepping enabled, for every substep.
| void FBodyInstance::AddRadialForceToBody | ( | const FVector & | Origin, |
| float | Radius, | ||
| float | Strength, | ||
| uint8 | Falloff, | ||
| bool | bAccelChange = false, |
||
| bool | bAllowSubstepping = true |
||
| ) |
Add a force to this bodyinstance, originating from the supplied world-space location.
| Origin | Origin of force in world space. |
| Radius | Radius within which to apply the force. |
| Strength | Strength of force to apply. |
| Falloff | Allows you to control the strength of the force as a function of distance from Origin. |
| bAccelChange | If true, Strength is taken as a change in acceleration instead of a physical force (i.e. mass will have no effect). |
| bAllowSubstepping | Whether we should sub-step this radial force. You should only turn this off if you're calling it from a sub-step callback, otherwise there will be energy loss |
| void FBodyInstance::AddRadialImpulseToBody | ( | const FVector & | Origin, |
| float | Radius, | ||
| float | Strength, | ||
| uint8 | Falloff, | ||
| bool | bVelChange = false |
||
| ) |
Add an impulse to this bodyinstance, radiating out from the specified position.
| Origin | Point of origin for the radial impulse blast, in world space |
| Radius | Size of radial impulse. Beyond this distance from Origin, there will be no affect. |
| Strength | Maximum strength of impulse applied to body. |
| Falloff | Allows you to control the strength of the impulse as a function of distance from Origin. |
| bVelChange | If true, the Strength is taken as a change in velocity instead of an impulse (ie. mass will have no effect). |
| void FBodyInstance::ApplyMaterialToInstanceShapes_AssumesLocked | ( | UPhysicalMaterial * | SimplePhysMat, |
| TArray< UPhysicalMaterial * > & | ComplexPhysMats, | ||
| const TArrayView< FPhysicalMaterialMaskParams > & | ComplexPhysMatMasks | ||
| ) |
Note: This function is not thread safe.
Make sure you obtain the appropriate physics scene lock before calling it
|
static |
Apply a material directly to the passed in shape.
Note this function is very advanced and requires knowledge of shape sharing as well as threading. Note: assumes the appropriate locks have been obtained
| PShape | The shape we are applying the material to |
| SimplePhysMat | The material to use if a simple shape is provided (or complex materials are empty) |
| ComplexPhysMats | The array of materials to apply if a complex shape is provided |
| bool FBodyInstance::DoesUseCollisionProfile | ( | ) | const |
return true if it uses Collision Profile System.
False otherwise
| int32 FBodyInstance::GetAllShapes_AssumesLocked | ( | TArray< FPhysicsShapeHandle > & | OutShapes | ) | const |
Utility to get all the shapes from a FBodyInstance NOTE: This function is not thread safe.
You must hold the physics scene lock while calling it and reading/writing from the shapes
| FVector FBodyInstance::GetBodyInertiaTensor | ( | ) | const |
Return the body's inertia tensor.
This is returned in local mass space
| void FBodyInstance::GetBodyInstanceResourceSizeEx | ( | FResourceSizeEx & | CumulativeResourceSize | ) | const |
Returns memory used by resources allocated for this body instance ( ex.
physics resources )
|
static |
Find the correct PhysicalMaterial and PhysicalMaterialMasks for complex geometry on a given body and owner.
This is really for internal use during serialization
Get the square of the distance to the body surface if available It is only valid if BodyShape is convex If point is inside or shape is not convex, it will return 0.f
| Point | Point in world space |
| OutPointOnBody | Point on the surface of body closest to Point |
|
inline |
Returns the mass override.
See MassInKgOverride for documentation
| const FBodyInstance * FBodyInstance::GetOriginalBodyInstance | ( | const FPhysicsShapeHandle & | InShape | ) | const |
Returns the original owning body instance.
This is needed for welding
|
static |
Find the correct PhysicalMaterial for simple geometry on a given body and owner.
This is really for internal use during serialization
| bool FBodyInstance::GetSquaredDistanceToBody | ( | const FVector & | Point, |
| float & | OutDistanceSquared, | ||
| FVector & | OutPointOnBody | ||
| ) | const |
Get distance to the body surface if available It is only valid if BodyShape is convex If point is inside distance it will be 0 Returns false if geometry is not supported
| Point | Point in world space |
| OutDistanceSquared | How far from the instance the point is. 0 if inside the shape |
| OutPointOnBody | Point on the surface of body closest to Point |
Get current velocity of a point on this physics body, in world space.
Point is specified in world space.
Get current velocity of a point on this physics body, in world space.
Point is specified in world space.
| const struct FWalkableSlopeOverride & FBodyInstance::GetWalkableSlopeOverride | ( | ) | const |
Returns the slope override struct for this instance.
If we don't have our own custom setting, it will return the setting from the body setup.
| void FBodyInstance::InitBody | ( | UBodySetup * | Setup, |
| const FTransform & | Transform, | ||
| UPrimitiveComponent * | PrimComp, | ||
| FPhysScene * | InRBScene, | ||
| const FInitBodySpawnParams & | SpawnParams | ||
| ) |
Initialise a single rigid body (this FBodyInstance) for the given body setup
| Setup | The setup to use to create the body |
| Transform | Transform of the body |
| PrimComp | The owning component |
| InRBScene | The physics scene to place the body into |
| SpawnParams | The parameters for determining certain spawn behavior |
| InAggregate | An aggregate to place the body into |
| void FBodyInstance::InitDynamicProperties_AssumesLocked | ( | ) |
Initialise dynamic properties for this instance when using physics - this must be done after scene addition.
Note: This function is not thread safe. Make sure to obtain the appropriate physics scene locks before calling this function
|
static |
Standalone path to batch initialize large amounts of static bodies, which will be deferred till the next scene update for fast scene addition.
| Bodies | |
| Transforms | |
| BodySetup | |
| PrimitiveComp | |
| InRBScene |
| bool FBodyInstance::LineTrace | ( | struct FHitResult & | OutHit, |
| const FVector & | Start, | ||
| const FVector & | End, | ||
| bool | bTraceComplex, | ||
| bool | bReturnPhysicalMaterial = false |
||
| ) | const |
Trace a ray against just this bodyinstance
| OutHit | Information about hit against this component, if true is returned |
| Start | Start location of the ray |
| End | End location of the ray |
| bTraceComplex | Should we trace against complex or simple collision of this body |
| bReturnPhysicalMaterial | Fill in the PhysMaterial field of OutHit |
| void FBodyInstance::LoadProfileData | ( | bool | bVerifyProfile | ) |
Update profile data if required
| bVerifyProfile - if true, it makes sure it has correct set up with current profile, if false, it overwrites from profile data (for backward compatibility) |
| FCalculateCustomProjection & FBodyInstance::OnCalculateCustomProjection | ( | ) |
Returns reference to the OnCalculateCustomProjection delegate.
Will allocate delegate struct if not already created.
| FRecalculatedMassProperties & FBodyInstance::OnRecalculatedMassProperties | ( | ) |
Returns reference to the OnRecalculatedMassProperties delegate.
Will allocate delegate struct if not already created.
| bool FBodyInstance::OverlapMulti | ( | TArray< struct FOverlapResult > & | InOutOverlaps, |
| const class UWorld * | World, | ||
| const FTransform * | pWorldToComponent, | ||
| const FVector & | Pos, | ||
| const FQuat & | Rot, | ||
| ECollisionChannel | TestChannel, | ||
| const struct FComponentQueryParams & | Params, | ||
| const struct FCollisionResponseParams & | ResponseParams, | ||
| const FCollisionObjectQueryParams & | ObjectQueryParams = FCollisionObjectQueryParams::DefaultObjectQueryParam |
||
| ) | const |
Determines the set of components that this body instance would overlap with at the supplied location/rotation
| InOutOverlaps | Array of overlaps found between this component in specified pose and the world (new overlaps will be appended, the array is not cleared!) |
| World | World to use for overlap test |
| pWorldToComponent | Used to convert the body instance world space position into local space before teleporting it to (Pos, Rot) [optional, use when the body instance isn't centered on the component instance] |
| Pos | Location to place the component's geometry at to test against the world |
| Rot | Rotation to place components' geometry at to test against the world |
| TestChannel | The 'channel' that this ray is in, used to determine which components to hit |
| Params | |
| ResponseParams | |
| ObjectQueryParams | List of object types it's looking for. When this enters, we do object query with component shape |
| bool FBodyInstance::OverlapTest | ( | const FVector & | Position, |
| const FQuat & | Rotation, | ||
| const struct FCollisionShape & | CollisionShape, | ||
| FMTDResult * | OutMTD = nullptr |
||
| ) | const |
Test if the bodyinstance overlaps with the specified shape at the specified position/rotation
| Position | Position to place the shape at before testing |
| Rotation | Rotation to apply to the shape before testing |
| CollisionShape | Shape to test against |
| OutMTD | The minimum translation direction needed to push the shape out of this BodyInstance. (Optional) |
| bool FBodyInstance::OverlapTest_AssumesLocked | ( | const FVector & | Position, |
| const FQuat & | Rotation, | ||
| const struct FCollisionShape & | CollisionShape, | ||
| FMTDResult * | OutMTD = nullptr |
||
| ) | const |
Test if the bodyinstance overlaps with the specified shape at the specified position/rotation Note: This function is not thread safe.
Make sure you obtain the physics scene read lock before calling it
| Position | Position to place the shape at before testing |
| Rotation | Rotation to apply to the shape before testing |
| CollisionShape | Shape to test against |
| OutMTD | The minimum translation direction needed to push the shape out of this BodyInstance. (Optional) |
| FORCEINLINE_DEBUGGABLE bool FBodyInstance::OverlapTestForBodies | ( | const FVector & | Position, |
| const FQuat & | Rotation, | ||
| const TArray< FBodyInstance * > & | Bodies | ||
| ) | const |
Test if the bodyinstance overlaps with the specified body instances
| Position | Position to place our shapes at before testing (shapes of this BodyInstance) |
| Rotation | Rotation to apply to our shapes before testing (shapes of this BodyInstance) |
| Bodies | The bodies we are testing for overlap with. These bodies will be in world space already |
| void FBodyInstance::SetBodyTransform | ( | const FTransform & | NewTransform, |
| ETeleportType | Teleport, | ||
| bool | bAutoWake = true |
||
| ) |
Move the physics body to a new pose.
| bTeleport | If true, no velocity is inferred on the kinematic body from this movement, but it moves right away. |
| void FBodyInstance::SetCollisionProfileName | ( | FName | InCollisionProfileName | ) |
Set Collision Profile Name This function should be called outside of constructors to set profile name.
This will change current CollisionProfileName to be this, and overwrite Collision Setting
| InCollisionProfileName | : New Profile Name |
| void FBodyInstance::SetCollisionProfileNameDeferred | ( | FName | InCollisionProfileName | ) |
Set Collision Profile Name (deferred) This function is called by constructors when they set ProfileName This will change current CollisionProfileName, but collision data will not be set up until the physics state is created or the collision profile is accessed.
| InCollisionProfileName | : New Profile Name |
| void FBodyInstance::SetContactReportForceThreshold | ( | float | Threshold | ) |
Set a new contact report force threhold.
Threshold < 0 disables this feature.
| void FBodyInstance::SetMassSpaceLocal | ( | const FTransform & | NewMassSpaceLocalTM | ) |
TODO: this only works at runtime when the physics state has been created.
Any changes that result in recomputing mass properties will not properly remember this
| void FBodyInstance::SetWalkableSlopeOverride | ( | const FWalkableSlopeOverride & | NewOverride, |
| bool | bNewOverideSetting = true |
||
| ) |
Sets a custom slope override struct for this instance.
Implicitly sets bOverrideWalkableSlopeOnInstance to true.
|
inline |
Whether we should interpolate when substepping.
| bool FBodyInstance::Sweep | ( | struct FHitResult & | OutHit, |
| const FVector & | Start, | ||
| const FVector & | End, | ||
| const FQuat & | ShapeWorldRotation, | ||
| const FCollisionShape & | Shape, | ||
| bool | bTraceComplex | ||
| ) | const |
Trace a shape against just this bodyinstance
| OutHit | Information about hit against this component, if true is returned |
| Start | Start location of the box |
| End | End location of the box |
| ShapeWorldRotation | The rotation applied to the collision shape in world space. |
| CollisionShape | Collision Shape |
| bTraceComplex | Should we trace against complex or simple collision of this body |
| void FBodyInstance::TermBody | ( | bool | bNeverDeferRelease = false | ) |
Terminates the body, releasing resources
| bNeverDeferRelease | In some cases orphaned actors can have their internal release deferred. If this isn't desired this flag will override that behavior |
| void FBodyInstance::UnWeld | ( | FBodyInstance * | Body | ) |
Takes a welded body and unwelds it.
This function does not create the new body, it only removes the old one
| bool FBodyInstance::UpdateBodyScale | ( | const FVector & | InScale3D, |
| bool | bForceUpdate = false |
||
| ) |
Update Body Scale
| InScale3D | New Scale3D. If that's different from previous Scale3D, it will update Body scale. |
| bForceUpdate | Will refresh shape dimensions from BodySetup, even if scale has not changed. |
|
static |
Validate a body transform, outputting debug info
| Transform | Transform to debug |
| DebugName | Name of the instance for logging |
| Setup | Body setup for this instance |
| bool FBodyInstance::Weld | ( | FBodyInstance * | Body, |
| const FTransform & | RelativeTM | ||
| ) |
Takes two body instances and welds them together to create a single simulated rigid body.
Returns true if success.
| uint8 FBodyInstance::bContactModification |
Enable contact modification.
Assumes custom contact modification has been provided (see FPhysXContactModifyCallback)
| uint8 FBodyInstance::bHACK_DisableCollisionResponse |
@HACK: These are ONLY used when the 'p.EnableDynamicPerBodyFilterHacks' CVar is set (disabled by default).
Some games need to dynamically modify collision per skeletal body. These provide game code a way to do that, until we're able to refactor how skeletal bodies work.
|
protected |
Internal flag to allow us to quickly check whether we should interpolate when substepping e.g.
kinematic bodies that are QueryOnly do not need to interpolate as we will not be querying them at a sub-position. This is complicated by welding, where multiple the CollisionEnabled flag of the root must be considered.
| float FBodyInstance::CustomSleepThresholdMultiplier |
If the SleepFamily is set to custom, multiply the natural sleep threshold by this amount.
A higher number will cause the body to sleep sooner.
| int32 FBodyInstance::InstanceBodyIndex |
Index of this BodyInstance within the SkeletalMeshComponent/PhysicsAsset.
Is INDEX_NONE if a single body component
|
protected |
Mass of the body in KG.
By default we compute this based on physical material and mass scale.
| TWeakObjectPtr<class UPrimitiveComponent> FBodyInstance::OwnerComponent |
PrimitiveComponent containing this body.
| float FBodyInstance::PhysicsBlendWeight |
Influence of rigid body physics (blending) on the mesh's pose (0.0 == use only animation, 1.0 == use only physics)
Provide appropriate interface for doing this instead of allowing BlueprintReadWrite
| uint8 FBodyInstance::PositionSolverIterationCount |
[PhysX Only] This physics body's solver iteration count for position.
Increasing this will be more CPU intensive, but better stabilized.
| float FBodyInstance::StabilizationThresholdMultiplier |
Stabilization factor for this body if Physics stabilization is enabled.
A higher number will cause more aggressive stabilization at the risk of loss of momentum at low speeds. A value of 0 will disable stabilization for this body.
| uint8 FBodyInstance::VelocitySolverIterationCount |
[PhysX Only] This physics body's solver iteration count for velocity.
Increasing this will be more CPU intensive, but better stabilized.
|
protected |
Custom walkable slope override setting for this instance.