The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
UE2:Actor native functions (UT2004)/Physics functions
The following things need to be done on this page or in this section:
|
Contents
- 1 Unreal physics functions
- 1.1 AttachToBone
- 1.2 AutonomousPhysics
- 1.3 DetachFromBone
- 1.4 FastTrace
- 1.5 GetClosestBone
- 1.6 IsJoinedTo
- 1.7 Move
- 1.8 MoveSmooth
- 1.9 OnlyAffectPawns
- 1.10 SetBase
- 1.11 SetCollision
- 1.12 SetCollisionSize
- 1.13 SetLocation
- 1.14 SetPhysics
- 1.15 SetRelativeLocation
- 1.16 SetRelativeRotation
- 1.17 SetRotation
- 1.18 SuggestFallVelocity
- 1.19 Trace
- 1.20 TraceThisActor
- 2 Karma physics functions
- 2.1 KAddAngularImpulse
- 2.2 KAddImpulse
- 2.3 KDisableCollision
- 2.4 KEnableCollision
- 2.5 KGetActorGravScale
- 2.6 KGetCOMOffset
- 2.7 KGetCOMPosition
- 2.8 KGetDampingProps
- 2.9 KGetFriction
- 2.10 KGetImpactThreshold
- 2.11 KGetInertiaTensor
- 2.12 KGetMass
- 2.13 KGetSkelMass
- 2.14 KIsAwake
- 2.15 KScaleJointLimits
- 2.16 KSetActorGravScale
- 2.17 KSetBlockKarma
- 2.18 KSetCOMOffset
- 2.19 KSetDampingProps
- 2.20 KSetFriction
- 2.21 KSetImpactThreshold
- 2.22 KSetInertiaTensor
- 2.23 KSetMass
- 2.24 KSetRestitution
- 2.25 KSetSimParams
- 2.26 KWake
- 3 Karma rigid body functions
- 4 Karma ragdoll functions
Unreal physics functions[edit]
AttachToBone[edit]
Attaches another actor to a specific skeletal mesh bone of this actor. If no bone name was specified, the actor is directly attached to this actor. Returns False on failure, including when this actor does not have a mesh.
As part of the attachment process, the other actor's Base is set to this actor and the actor is added to this actor's Attached array.
AutonomousPhysics[edit]
DetachFromBone[edit]
Undoes the effects of AttachToBone(Attachment) by separating the specified actor from this actor. Returns False if this actor does not have a mesh to detach the specified actor from.
FastTrace[edit]
Performs a zero-width line trace from TraceStart to TraceEnd (both absolute world coordinates) and returns True if it did not hit any world geometry between the two points.
GetClosestBone[edit]
If the actor has a skeletal mesh, this function will return the name of the bone closest to the specified trace ray. The BiasBone will be preferred if it is not further away from the trace ray than BiasDist. If no BiasBone was specified or the trace ray didn't get close enough to it, the closest bone to the trace ray is returned.
The most important use for this function is to detect locational hits, especially head shots with the sniper rifle (ClassicSniperRifle) and lightning gun (SniperRifle).
IsJoinedTo[edit]
Checks whether this actor is somehow joined to the other actor, either through regular attachment with AttachToBone or SetBase functions or via any KConstraint actor.
Move[edit]
Moves this actor by the delta vector and checks for collisions according to the actor's collision settings. Unlike SetLocation, the collision checks are performed for the entire movement path.
MoveSmooth[edit]
Smoothly moves the actor by the delta vector and checks for collisions according to the actor's collision settings. Like Move, collision checks are performed for the entire path, but additionally the actor is moved along a hit wall instead of just stopping there.
OnlyAffectPawns[edit]
Modifies the value of bOnlyAffectPawns, i.e. whether this actor ignores any collisions with non-Pawn actors.
SetBase[edit]
Attaches the actor to a new base actor and optionally specifies a new floor normal.
SetCollision[edit]
Adjusts this actor's collision settings. Another important collision setting, bCollideWorld, can be manipulated directly.
SetCollisionSize[edit]
Sets the size of this actor's collision cylinder.
SetLocation[edit]
Sets this actor's Location. At the target location, a collision check is performed according to the collision settings. If this actor collides with world geometry and the target location is inside a wall, SetLocation first attempts to adjust the location so the actor fits there. If that fails, the actor stays where it was before the SetLocation call and this function returns False.
SetPhysics[edit]
Adjusts the actor's Physics mode.
SetRelativeLocation[edit]
Sets the RelativeLocation for an attached actor.
SetRelativeRotation[edit]
Sets the RelativeRotation for an attached actor.
SetRotation[edit]
Sets the Rotation of this actor. If the actor does not fit in its current location due to the newly aligned collision shape, this function returns False. Note that the default collision cylinder is not actually affected by thew actor's rotation.
SuggestFallVelocity[edit]
Attempts to calculate a velocity vector so that an actor starting at Start ends up at Destination if only affected by gravity. The MaxZ and MaxXYSpeed parameters specify the maximum vertical and horizontal velocity magnitudes allowed for the return value.
This function is used by the AI to determine the fire direction for grenade-like projectiles, to find out whether a jump is possible and to calculate the jump velocity for regular and impact jumps.
Trace[edit]
Performs a line check and returns the first actor that was hit. Returns the map's LevelInfo if a BSP surface was hit and None
if nothing was hit.
Parameters:
- HitLocation - returns the world location where the trace has hit an actor. Origin if nothing was hit.
- HitNormal - returns a unit vector pointing away from the hit actor's surface. Returns the zero vector if nothing was hit.
- TraceEnd - the target world location to trace towards.
- TraceStart - the source world location to start tracing from. Defaults to the actor's location if omitted.
- bTraceActors - whether all colliding actors should be traced. If False, only world geometry is traced. Defaults to True if the calling actor can collide (bCollideActors), otherwise defaults to False.
- Extent - the trace extent. Defaults to the zero vector, which performs a simple line check. Non-zero extents should have the same positive value for all three vector components, otherwise results may be unpredictable.
- Material - returns the hit surface material for BSP or terrain,
None
for other types of hit actors. For terrain the "most dominant" material of the hit terrain section is used, based on the average layer alpha values on that terrain section.
TraceThisActor[edit]
Performs a trace check on the collision of the calling actor and returns True if it did not hit this actor. World geometry and other actors are ignored.