Class Controller
Controllers are non-physical actors that can possess a Pawn to control its actions.
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class Controller : Actor
Remarks
PlayerControllers are used by human players to control pawns, while AIControllers implement the artificial intelligence for the pawns they control. Controllers take control of a pawn using their Possess() method, and relinquish control of the pawn by calling UnPossess().
Controllers receive notifications for many of the events occurring for the Pawn they are controlling. This gives the controller the opportunity to implement the behavior in response to this event, intercepting the event and superseding the Pawn's default behavior.
ControlRotation (accessed via GetControlRotation()), determines the viewing/aiming direction of the controlled Pawn and is affected by input such as from a mouse or gamepad.
@see https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Controller/
Properties
| Improve this Doc View SourcebAttachToPawn
Declaration
public bool bAttachToPawn { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bIsPlayerController
Declaration
public bool bIsPlayerController { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Character
Character currently being controlled by this controller. Value is same as Pawn if the controlled pawn is a character, otherwise nullptr
Declaration
public Character Character { get; set; }
Property Value
Type | Description |
---|---|
Character |
ControlRotation
The control rotation of the Controller. See GetControlRotation.
Declaration
public Rotator ControlRotation { get; set; }
Property Value
Type | Description |
---|---|
Rotator |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static Controller DefaultObject { get; }
Property Value
Type | Description |
---|---|
Controller |
Pawn
Pawn currently being controlled by this controller. Use Pawn.Possess() to take control of a pawn
Declaration
public Pawn Pawn { get; set; }
Property Value
Type | Description |
---|---|
Pawn |
PlayerState
PlayerState containing replicated information about the player using this controller (only exists for players, not NPCs).
Declaration
public PlayerState PlayerState { get; }
Property Value
Type | Description |
---|---|
PlayerState |
StateName
Current gameplay state this controller is in
Declaration
public Name StateName { get; set; }
Property Value
Type | Description |
---|---|
Name |
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
Type | Description |
---|---|
Class |
TransformComponent
Component to give controllers a transform and enable attachment if desired.
Declaration
public SceneComponent TransformComponent { get; set; }
Property Value
Type | Description |
---|---|
SceneComponent |
Methods
| Improve this Doc View SourceCastToPlayerController()
Cast to Player Controller
Declaration
public PlayerController CastToPlayerController()
Returns
Type | Description |
---|---|
PlayerController |
GetControlRotation()
Get the control rotation.
Declaration
public Rotator GetControlRotation()
Returns
Type | Description |
---|---|
Rotator |
Remarks
This is the full aim rotation, which may be different than a camera orientation (for example in a third person view), and may differ from the rotation of the controlled Pawn (which may choose not to visually pitch or roll, for example).
GetDesiredRotation()
Get the desired pawn target rotation
Declaration
public Rotator GetDesiredRotation()
Returns
Type | Description |
---|---|
Rotator |
GetViewTarget()
Get the actor the controller is looking at
Declaration
public Actor GetViewTarget()
Returns
Type | Description |
---|---|
Actor |
IsLocalController()
Returns whether this Controller is a local controller.
Declaration
public bool IsLocalController()
Returns
Type | Description |
---|---|
System.Boolean |
IsLocalPlayerController()
Returns whether this Controller is a locally controlled PlayerController.
Declaration
public bool IsLocalPlayerController()
Returns
Type | Description |
---|---|
System.Boolean |
IsLookInputIgnored()
Returns true if look input is ignored.
Declaration
public bool IsLookInputIgnored()
Returns
Type | Description |
---|---|
System.Boolean |
IsMoveInputIgnored()
Returns true if movement input is ignored.
Declaration
public bool IsMoveInputIgnored()
Returns
Type | Description |
---|---|
System.Boolean |
IsPlayerController()
Returns whether this Controller is a PlayerController.
Declaration
public bool IsPlayerController()
Returns
Type | Description |
---|---|
System.Boolean |
K2_GetPawn()
Return the Pawn that is currently 'controlled' by this PlayerController
Declaration
public Pawn K2_GetPawn()
Returns
Type | Description |
---|---|
Pawn |
LineOfSightTo(Actor, Vector, Boolean)
Checks line to center and top of other actor @
Declaration
public bool LineOfSightTo(Actor Other, Vector ViewPoint, bool bAlternateChecks)
Parameters
Type | Name | Description |
---|---|---|
Actor | Other | |
Vector | ViewPoint | |
System.Boolean | bAlternateChecks |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
param Other is the actor whose visibility is being checked. @param ViewPoint is eye position visibility is being checked from. If vect(0,0,0) passed in, uses current viewtarget's eye position. @param bAlternateChecks used only in AIController implementation @return true if controller's pawn can see Other actor.
New(UObject, Name)
Spawn an object of this class
Declaration
public static Controller New(UObject obj = null, Name name = default(Name))
Parameters
Type | Name | Description |
---|---|---|
UObject | obj | |
Name | name |
Returns
Type | Description |
---|---|
Controller |
Possess(Pawn)
Handles attaching this controller to the specified pawn.
Declaration
public void Possess(Pawn InPawn)
Parameters
Type | Name | Description |
---|---|---|
Pawn | InPawn |
Remarks
Only runs on the network authority (where HasAuthority() returns true). @param InPawn The Pawn to be possessed. @see HasAuthority()
ResetIgnoreInputFlags()
Reset move and look input ignore flags.
Declaration
public void ResetIgnoreInputFlags()
ResetIgnoreLookInput()
Stops ignoring look input by resetting the ignore look input state.
Declaration
public void ResetIgnoreLookInput()
ResetIgnoreMoveInput()
Stops ignoring move input by resetting the ignore move input state.
Declaration
public void ResetIgnoreMoveInput()
SetControlRotation(Rotator)
Set the control rotation.
Declaration
public void SetControlRotation(Rotator NewRotation)
Parameters
Type | Name | Description |
---|---|---|
Rotator | NewRotation |
SetIgnoreLookInput(Boolean)
Locks or unlocks look input, consecutive calls stack up and require the same amount of calls to undo, or can all be undone using ResetIgnoreLookInput.
Declaration
public void SetIgnoreLookInput(bool bNewLookInput)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bNewLookInput |
Remarks
@param bNewLookInput If true, look input is ignored. If false, input is not ignored.
SetIgnoreMoveInput(Boolean)
Locks or unlocks movement input, consecutive calls stack up and require the same amount of calls to undo, or can all be undone using ResetIgnoreMoveInput.
Declaration
public void SetIgnoreMoveInput(bool bNewMoveInput)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bNewMoveInput |
Remarks
@param bNewMoveInput If true, move input is ignored. If false, input is not ignored.
SetInitialLocationAndRotation(Vector, Rotator)
Set the initial location and rotation of the controller, as well as the control rotation. Typically used when the controller is first created.
Declaration
public void SetInitialLocationAndRotation(Vector NewLocation, Rotator NewRotation)
Parameters
Type | Name | Description |
---|---|---|
Vector | NewLocation | |
Rotator | NewRotation |
StopMovement()
Aborts the move the controller is currently performing
Declaration
public void StopMovement()
UnPossess()
Called to unpossess our pawn for any reason that is not the pawn being destroyed (destruction handled by PawnDestroyed()).
Declaration
public void UnPossess()
Events
| Improve this Doc View SourceReceiveInstigatedAnyDamage
Event when this controller instigates ANY damage
Declaration
public event Controller.ReceiveInstigatedAnyDamage_delegate ReceiveInstigatedAnyDamage
Event Type
Type | Description |
---|---|
Controller.ReceiveInstigatedAnyDamage_delegate |
Operators
| Improve this Doc View SourceImplicit(IntPtr to Controller)
Convert from IntPtr to UObject
Declaration
public static implicit operator Controller(IntPtr p)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | p |
Returns
Type | Description |
---|---|
Controller |