The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

UE2:Actor native functions (UT2004)/Physics functions

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Unreal physics functions[edit]

AttachToBone[edit]

native final function bool AttachToBone (Actor Attachment, name BoneName)

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]

native(3971) final function AutonomousPhysics (float DeltaSeconds)


DetachFromBone[edit]

native final function bool DetachFromBone (Actor Attachment)

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]

native(548) final function bool FastTrace (Object.Vector TraceEnd, optional Object.Vector TraceStart)

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]

native final function name GetClosestBone (Object.Vector loc, Object.Vector ray, out float boneDist, optional name BiasBone, optional float BiasDistance)

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]

native final function bool IsJoinedTo (Actor Other)

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]

native(266) final function bool Move (Object.Vector Delta)

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]

native(3969) final function bool MoveSmooth (Object.Vector Delta)

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]

native final function OnlyAffectPawns (bool B)

Modifies the value of bOnlyAffectPawns, i.e. whether this actor ignores any collisions with non-Pawn actors.

SetBase[edit]

native(298) final function SetBase (Actor NewBase, optional Object.Vector NewFloor)

Attaches the actor to a new base actor and optionally specifies a new floor normal.

SetCollision[edit]

native(262) final function SetCollision (optional bool NewColActors, optional bool NewBlockActors, optional bool NewBlockPlayers)

Adjusts this actor's collision settings. Another important collision setting, bCollideWorld, can be manipulated directly.

SetCollisionSize[edit]

native(283) final function bool SetCollisionSize (float NewRadius, float NewHeight)

Sets the size of this actor's collision cylinder.

SetLocation[edit]

native(267) final function bool SetLocation (Object.Vector NewLocation)

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]

native(3970) final function SetPhysics (EPhysics newPhysics)

Adjusts the actor's Physics mode.

SetRelativeLocation[edit]

native final function bool SetRelativeLocation (Object.Vector NewLocation)

Sets the RelativeLocation for an attached actor.

SetRelativeRotation[edit]

native final function bool SetRelativeRotation (Object.Rotator NewRotation)

Sets the RelativeRotation for an attached actor.

SetRotation[edit]

native(299) final function bool SetRotation (Object.Rotator NewRotation)

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]

native final function Object.Vector SuggestFallVelocity (Object.Vector Destination, Object.Vector Start, float MaxZ, float MaxXYSpeed)

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]

native(277) final function Actor Trace (out Object.Vector HitLocation, out Object.Vector HitNormal, Object.Vector TraceEnd, optional Object.Vector TraceStart, optional bool bTraceActors, optional Object.Vector Extent, optional out Material Material)

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]

native final function bool TraceThisActor (out Object.Vector HitLocation, out Object.Vector HitNormal, Object.Vector TraceEnd, Object.Vector TraceStart, optional Object.Vector Extent)

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.

Karma physics functions[edit]

KAddAngularImpulse[edit]

native final function KAddAngularImpulse (Object.Vector AngImpulse)


KAddImpulse[edit]

native final function KAddImpulse (Object.Vector Impulse, Object.Vector Position, optional name BoneName)


KDisableCollision[edit]

native final function KDisableCollision (Actor Other)


KEnableCollision[edit]

native final function KEnableCollision (Actor Other)


KGetActorGravScale[edit]

native final function float KGetActorGravScale ()


KGetCOMOffset[edit]

native final function KGetCOMOffset (out Object.Vector offset)


KGetCOMPosition[edit]

native final function KGetCOMPosition (out Object.Vector pos)


KGetDampingProps[edit]

native final function KGetDampingProps (out float lindamp, out float angdamp)


KGetFriction[edit]

native final function float KGetFriction ()


KGetImpactThreshold[edit]

native final function float KGetImpactThreshold ()


KGetInertiaTensor[edit]

native final function KGetInertiaTensor (out Object.Vector it1, out Object.Vector it2)


KGetMass[edit]

native final function float KGetMass ()


KGetSkelMass[edit]

native final function float KGetSkelMass ()


KIsAwake[edit]

native final function bool KIsAwake ()


KScaleJointLimits[edit]

native final function KScaleJointLimits (float scale, float stiffness)


KSetActorGravScale[edit]

native final function KSetActorGravScale (float ActorGravScale)


KSetBlockKarma[edit]

native final function KSetBlockKarma (bool newBlock)


KSetCOMOffset[edit]

native final function KSetCOMOffset (Object.Vector offset)


KSetDampingProps[edit]

native final function KSetDampingProps (float lindamp, float angdamp)


KSetFriction[edit]

native final function KSetFriction (float friction)


KSetImpactThreshold[edit]

native final function KSetImpactThreshold (float thresh)


KSetInertiaTensor[edit]

native final function KSetInertiaTensor (Object.Vector it1, Object.Vector it2)


KSetMass[edit]

native final function KSetMass (float mass)


KSetRestitution[edit]

native final function KSetRestitution (float rest)


KSetSimParams[edit]

native final function KSetSimParams (KSimParams SimParams)


KWake[edit]

native final function KWake ()


Karma rigid body functions[edit]

KDrawRigidBodyState[edit]

native final function KDrawRigidBodyState (KRigidBodyState RBState, bool AltColour)


KGetRBQuaternion[edit]

native final function Object.Quat KGetRBQuaternion ()


KGetRestitution[edit]

native final function float KGetRestitution ()


KGetRigidBodyState[edit]

native final function KGetRigidBodyState (out KRigidBodyState RBstate)


KGetSimParams[edit]

native final function KGetSimParams (out KSimParams SimParams)


KRBVecFromVector[edit]

native final function KRBVec KRBVecFromVector (Object.Vector v)


KRBVecToVector[edit]

native final function Object.Vector KRBVecToVector (KRBVec RBvec)


KSetStayUpright[edit]

native final function KSetStayUpright (bool stayUpright, bool allowRotate)


KSetStayUprightParams[edit]

native final function KSetStayUprightParams (float stiffness, float damping)


Karma ragdoll functions[edit]

KAddBoneLifter[edit]

native final function KAddBoneLifter (name BoneName, Object.InterpCurve LiftVel, float LateralFriction, Object.InterpCurve Softness)


KFreezeRagdoll[edit]

native final function KFreezeRagdoll ()


KIsRagdollAvailable[edit]

native final function bool KIsRagdollAvailable ()


KMakeRagdollAvailable[edit]

native final function KMakeRagdollAvailable ()


KRemoveAllBoneLifters[edit]

native final function KRemoveAllBoneLifters ()


KRemoveLifterFromBone[edit]

native final function KRemoveLifterFromBone (name BoneName)


KSetSkelVel[edit]

native final function KSetSkelVel (Object.Vector Velocity, optional Object.Vector AngVelocity, optional bool AddToCurrent)