Navigation
API > API/Runtime > API/Runtime/Engine
This component tries to maintain its children at a fixed distance from the parent, but will retract the children if there is a collision, and spring back when there is no collision.
Example: Use as a 'camera boom' or 'selfie stick' to keep the follow camera for a player from colliding into the world.
| Name | USpringArmComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/GameFramework/SpringArmComponent.h |
| Include Path | #include "GameFramework/SpringArmComponent.h" |
Syntax
UCLASS (ClassGroup=Camera, Meta=(BlueprintSpawnableComponent), HideCategories=(Mobility),
MinimalAPI)
class USpringArmComponent : public USceneComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → USpringArmComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
USpringArmComponent
(
const FObjectInitializer& ObjectInitializer |
GameFramework/SpringArmComponent.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| SocketName | const FName | The name of the socket at the end of the spring arm (looking back towards the spring arm origin) | GameFramework/SpringArmComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bClampToMaxPhysicsDeltaTime | uint32 | If true AND the view target is simulating using physics then use the same max timestep cap as the physics system. | GameFramework/SpringArmComponent.h |
|
| bDoCollisionTest | uint32 | If true, do a collision test using ProbeChannel and ProbeSize to prevent camera clipping into level. | GameFramework/SpringArmComponent.h |
|
| bDrawDebugLagMarkers | uint32 | If true and camera location lag is enabled, draws markers at the camera target (in green) and the lagged position (in yellow). | GameFramework/SpringArmComponent.h |
|
| bEnableCameraLag | uint32 | If true, camera lags behind target position to smooth its movement. | GameFramework/SpringArmComponent.h |
|
| bEnableCameraRotationLag | uint32 | If true, camera lags behind target rotation to smooth its movement. | GameFramework/SpringArmComponent.h |
|
| bInheritPitch | uint32 | Should we inherit pitch from parent component. Does nothing if using Absolute Rotation. | GameFramework/SpringArmComponent.h |
|
| bInheritRoll | uint32 | Should we inherit roll from parent component. Does nothing if using Absolute Rotation. | GameFramework/SpringArmComponent.h |
|
| bInheritYaw | uint32 | Should we inherit yaw from parent component. Does nothing if using Absolute Rotation. | GameFramework/SpringArmComponent.h |
|
| bIsCameraFixed | bool | Temporary variables when applying Collision Test displacement to notify if its being applied and by how much | GameFramework/SpringArmComponent.h | |
| bUseCameraLagSubstepping | uint32 | If bUseCameraLagSubstepping is true, sub-step camera damping so that it handles fluctuating frame rates well (though this comes at a cost). | GameFramework/SpringArmComponent.h |
|
| bUsePawnControlRotation | uint32 | If this component is placed on a pawn, should it use the view/control rotation of the pawn where possible? When disabled, the component will revert to using the stored RelativeRotation of the component. | GameFramework/SpringArmComponent.h |
|
| CameraLagMaxDistance | float | Max distance the camera target may lag behind the current location. | GameFramework/SpringArmComponent.h |
|
| CameraLagMaxTimeStep | float | Max time step used when sub-stepping camera lag. | GameFramework/SpringArmComponent.h |
|
| CameraLagSpeed | float | If bEnableCameraLag is true, controls how quickly camera reaches target position. | GameFramework/SpringArmComponent.h |
|
| CameraRotationLagSpeed | float | If bEnableCameraRotationLag is true, controls how quickly camera reaches target position. | GameFramework/SpringArmComponent.h |
|
| PreviousArmOrigin | FVector | GameFramework/SpringArmComponent.h | ||
| PreviousDesiredLoc | FVector | Temporary variables when using camera lag, to record previous camera position | GameFramework/SpringArmComponent.h | |
| PreviousDesiredRot | FRotator | Temporary variable for lagging camera rotation, for previous rotation | GameFramework/SpringArmComponent.h | |
| ProbeChannel | TEnumAsByte< ECollisionChannel > | Collision channel of the query probe (defaults to ECC_Camera) | GameFramework/SpringArmComponent.h |
|
| ProbeSize | float | How big should the query probe sphere be (in unreal units) | GameFramework/SpringArmComponent.h |
|
| SocketOffset | FVector | Offset at end of spring arm; use this instead of the relative offset of the attached component to ensure the line trace works as desired | GameFramework/SpringArmComponent.h |
|
| TargetArmLength | float | Natural length of the spring arm when there are no collisions | GameFramework/SpringArmComponent.h |
|
| TargetOffset | FVector | Offset at start of spring, applied in world space. | GameFramework/SpringArmComponent.h |
|
| UnfixedCameraPosition | FVector | GameFramework/SpringArmComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FRotator GetDesiredRotation() |
Returns the desired rotation for the spring arm, before the rotation constraints such as bInheritPitch etc are enforced. | GameFramework/SpringArmComponent.h | |
FRotator GetTargetRotation () |
Get the target rotation we inherit, used as the base target for the boom rotation. | GameFramework/SpringArmComponent.h |
|
FVector GetUnfixedCameraPosition() |
Get the position where the camera should be without applying the Collision Test displacement | GameFramework/SpringArmComponent.h |
|
bool IsCollisionFixApplied() |
Is the Collision Test displacement being applied? | GameFramework/SpringArmComponent.h |
|
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FTransform GetSocketTransform
(
FName InSocketName, |
Get world-space socket transform. | GameFramework/SpringArmComponent.h | |
virtual bool HasAnySockets() |
Returns true if this component has any sockets | GameFramework/SpringArmComponent.h | |
virtual void QuerySupportedSockets
(
TArray< FComponentSocketDescription >& OutSockets |
Get a list of sockets this component contains | GameFramework/SpringArmComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyWorldOffset
(
const FVector& InOffset, |
Called by owner actor on position shifting Component should update all relevant data structures to reflect new actor location | GameFramework/SpringArmComponent.h | |
virtual void OnRegister() |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | GameFramework/SpringArmComponent.h | |
virtual void TickComponent
(
float DeltaTime, |
Function called every frame on this ActorComponent. | GameFramework/SpringArmComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostLoad() |
GameFramework/SpringArmComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FVector BlendLocations
(
const FVector& DesiredArmLocation, |
This function allows subclasses to blend the trace hit location with the desired arm location; by default it returns bHitSomething ? TraceHitLocation : DesiredArmLocation | GameFramework/SpringArmComponent.h | |
virtual void UpdateDesiredArmLocation
(
bool bDoTrace, |
Updates the desired arm location, calling BlendLocations to do the actual blending if a trace is done | GameFramework/SpringArmComponent.h |