I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Difference between revisions of "UE2:Actor native functions (UT2004)/Physics functions"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(New page: <!-- included content for section Physics functions of article UE2:Actor native functions (UT2004) --> {{todo| *add descriptions or Karma-related functions *Karma function grouping needs t...)
 
m (Trace: added more details)
Line 103: Line 103:
 
{{code|native(277) final function {{cl|Actor}}&nbsp;'''Trace''' (out&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''HitLocation''', out&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''HitNormal''', {{tl|Vector|Object|structs}}&nbsp;'''TraceEnd''', optional&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''TraceStart''', optional&nbsp;[[bool]]&nbsp;'''bTraceActors''', optional&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''Extent''', optional&nbsp;out&nbsp;{{cl|Material}}&nbsp;'''Material''')}}
 
{{code|native(277) final function {{cl|Actor}}&nbsp;'''Trace''' (out&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''HitLocation''', out&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''HitNormal''', {{tl|Vector|Object|structs}}&nbsp;'''TraceEnd''', optional&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''TraceStart''', optional&nbsp;[[bool]]&nbsp;'''bTraceActors''', optional&nbsp;{{tl|Vector|Object|structs}}&nbsp;'''Extent''', optional&nbsp;out&nbsp;{{cl|Material}}&nbsp;'''Material''')}}
  
Performs a trace check and returns the first actor hit, if any.
+
Performs a line check and returns the first actor that was hit. Returns the map's {{cl|LevelInfo}} if a [[BSP]] surface was hit and <code>[[None]]</code> if nothing was hit.
  
;Parameters:
+
'''Parameters:'''
 
* ''HitLocation'' - returns the world location where the trace has hit an actor. Origin if nothing was hit.
 
* ''HitLocation'' - returns the world location where the trace has hit an actor. Origin if nothing was hit.
* ''HitNormal'' - returns a [[wp:unit vector|unit vector]] pointing away from the hit actor's surface. Returns the zro vector if nothing was hit.
+
* ''HitNormal'' - returns a [[wp:unit vector|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.
 
* ''TraceEnd'' - the target world location to trace towards.
* ''TraceStart'' - the source world location to start tracing from. Calling actor's location if omitted.
+
* ''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 ({{tl|bCollideActors||Actor properties}}), otherwise defaults to ''False''.
 
* ''bTraceActors'' - whether all colliding actors should be traced. If ''False'', only world geometry is traced. Defaults to ''True'' if the calling actor can collide ({{tl|bCollideActors||Actor properties}}), 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.
 
* ''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's material, if a BSP surface is hit.
+
* ''Material'' - returns the hit surface material for BSP or terrain, <code>None</code> 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====
 
====TraceThisActor====

Revision as of 04:06, 27 June 2010

Unreal physics functions

AttachToBone

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

native(3971) final function AutonomousPhysics (float DeltaSeconds)


DetachFromBone

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

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

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

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

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

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

native final function OnlyAffectPawns (bool B)

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

SetBase

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

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

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

Sets the size of this actor's collision cylinder.

SetLocation

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

native(3970) final function SetPhysics (EPhysics newPhysics)

Adjusts the actor's Physics mode.

SetRelativeLocation

native final function bool SetRelativeLocation (Object.Vector NewLocation)

Sets the RelativeLocation for an attached actor.

SetRelativeRotation

native final function bool SetRelativeRotation (Object.Rotator NewRotation)

Sets the RelativeRotation for an attached actor.

SetRotation

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

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

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

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

KAddAngularImpulse

native final function KAddAngularImpulse (Object.Vector AngImpulse)


KAddImpulse

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


KDisableCollision

native final function KDisableCollision (Actor Other)


KEnableCollision

native final function KEnableCollision (Actor Other)


KGetActorGravScale

native final function float KGetActorGravScale ()


KGetCOMOffset

native final function KGetCOMOffset (out Object.Vector offset)


KGetCOMPosition

native final function KGetCOMPosition (out Object.Vector pos)


KGetDampingProps

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


KGetFriction

native final function float KGetFriction ()


KGetImpactThreshold

native final function float KGetImpactThreshold ()


KGetInertiaTensor

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


KGetMass

native final function float KGetMass ()


KGetSkelMass

native final function float KGetSkelMass ()


KIsAwake

native final function bool KIsAwake ()


KScaleJointLimits

native final function KScaleJointLimits (float scale, float stiffness)


KSetActorGravScale

native final function KSetActorGravScale (float ActorGravScale)


KSetBlockKarma

native final function KSetBlockKarma (bool newBlock)


KSetCOMOffset

native final function KSetCOMOffset (Object.Vector offset)


KSetDampingProps

native final function KSetDampingProps (float lindamp, float angdamp)


KSetFriction

native final function KSetFriction (float friction)


KSetImpactThreshold

native final function KSetImpactThreshold (float thresh)


KSetInertiaTensor

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


KSetMass

native final function KSetMass (float mass)


KSetRestitution

native final function KSetRestitution (float rest)


KSetSimParams

native final function KSetSimParams (KSimParams SimParams)


KWake

native final function KWake ()


Karma rigid body functions

KDrawRigidBodyState

native final function KDrawRigidBodyState (KRigidBodyState RBState, bool AltColour)


KGetRBQuaternion

native final function Object.Quat KGetRBQuaternion ()


KGetRestitution

native final function float KGetRestitution ()


KGetRigidBodyState

native final function KGetRigidBodyState (out KRigidBodyState RBstate)


KGetSimParams

native final function KGetSimParams (out KSimParams SimParams)


KRBVecFromVector

native final function KRBVec KRBVecFromVector (Object.Vector v)


KRBVecToVector

native final function Object.Vector KRBVecToVector (KRBVec RBvec)


KSetStayUpright

native final function KSetStayUpright (bool stayUpright, bool allowRotate)


KSetStayUprightParams

native final function KSetStayUprightParams (float stiffness, float damping)


Karma ragdoll functions

KAddBoneLifter

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


KFreezeRagdoll

native final function KFreezeRagdoll ()


KIsRagdollAvailable

native final function bool KIsRagdollAvailable ()


KMakeRagdollAvailable

native final function KMakeRagdollAvailable ()


KRemoveAllBoneLifters

native final function KRemoveAllBoneLifters ()


KRemoveLifterFromBone

native final function KRemoveLifterFromBone (name BoneName)


KSetSkelVel

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