Humanoid Control for Unity  v3
Passer.Pawn.PawnControl Class Reference

Controls players using controller input More...

Inheritance diagram for Passer.Pawn.PawnControl:
Passer.Humanoid.HumanoidControl

Public Types

enum  StartPosition { AvatarPosition, PlayerPosition }
 Types of startposition for the Pawn More...
 
enum  MatchingType { None, SetHeightToCharacter }
 Options for matching the player to the game character More...
 
enum  TargetId { HeadTarget, LeftHandTarget, RightHandTarget }
 Target type More...
 

Public Member Functions

void set_bodyPull (bool value)
 
virtual CharacterController GetCharacter ()
 
virtual void InitTargets ()
 
virtual void Calibrate ()
 Calibrates the tracking with the player More...
 
virtual void SetStartPosition ()
 
virtual void AdjustTracking (Vector3 delta)
 Adjust the tracking origin of all trackers More...
 
virtual void MoveForward (float z)
 Move the Pawn forward with the given speed More...
 
virtual void MoveSideward (float x)
 Move the Parn sideward (left/right) with the given speed More...
 
virtual void Stop ()
 Stop any translational movement of the Pawn More...
 
virtual void Rotate (float angularSpeed)
 Rotate the pawn More...
 
virtual void Rotation (float yAngle)
 Set the rotation angle along Y axis More...
 
IEnumerator RotateTo (Quaternion targetRotation)
 Rotation animation to reach the given rotation More...
 
IEnumerator LookAt (Vector3 targetPosition)
 Rotation animation to look at the given position More...
 
IEnumerator WalkTo (Vector3 targetPosition)
 Movement animation to reach the given position More...
 
IEnumerator WalkTo (Vector3 targetPosition, Quaternion targetRotation)
 Movement animation to reach the given position and rotation More...
 
virtual void Jump (float takeoffVelocity)
 Let the pawn jump More...
 
virtual float GetDistanceToGroundAt (Vector3 position, float maxDistance, out Transform ground, out Vector3 normal)
 

Public Attributes

bool showRealObjects = true
 If true, real world objects like controllers and cameras are shown in the scene More...
 
bool physics = true
 Enables controller physics and collisions during walking. More...
 
bool useGravity = true
 If there is not static object below the feet of the avatar the avatar will fall down until it reaches solid ground More...
 
float stepOffset = 0.3F
 The maximum height of objects of the ground which do not stop the humanoid More...
 
bool bodyPull = false
 Will move the pawn position when grabbing handles on static objects More...
 
bool proximitySpeed = false
 Reduces the walking speed of the humanoid when in the neighbourhood of objects to reduce motion sickness. More...
 
float proximitySpeedRate = 0.8f
 The amount of influence of the proximity speed. 1=No influence, 0 = Maximum More...
 
StartPosition startPosition = StartPosition.AvatarPosition
 The start position of the humanoid More...
 
bool calibrateAtStart = false
 Perform a calibration when the scene starts More...
 
bool dontDestroyOnLoad = false
 Sets the Don't Destoy On Load such that the pawn survives scene changes More...
 
Tracking.UnityXR unity
 
UnityTracker unityTracker = new UnityTracker()
 
float forwardSpeed = 1
 maximum forward speed in units(meters)/second More...
 
float backwardSpeed = 0.6F
 maximum backward speed in units(meters)/second More...
 
float sidewardSpeed = 1
 maximum sideways speed in units(meters)/second More...
 
float maxAcceleration = 1
 maximum acceleration in units(meters)/second/second value 0 = no maximum acceleration More...
 
float rotationSpeed = 60
 maximum rotational speed in degrees/second More...
 
Vector3 velocity
 The current velocity of the Pawn More...
 
Transform ground
 The ground Transform on which the pawn is standing More...
 
Vector3 groundVelocity
 The velocity of the ground on which the pawn is standing More...
 
float groundAngularVelocity
 The angular velocity of the ground on which the pawn is standing More...
 
IPawnNetworking networking
 The networking interface More...
 
bool isRemote = false
 Is true when this is a remote pawn More...
 
ulong nwId
 The Id of this pawn across the network More...
 
int id = -1
 The local Id of this humanoid More...
 

Protected Member Functions

virtual void Awake ()
 
virtual float GetCharacterSoleThickness ()
 
virtual void UpdateCharacter ()
 
virtual void NewTargetComponents ()
 
virtual void StartTargets ()
 
virtual void UpdateTargets ()
 
virtual void InitTrackers ()
 
virtual void StartTrackers ()
 
virtual void UpdateTrackers ()
 
virtual void StartSensors ()
 
virtual void StopSensors ()
 
virtual void Update ()
 
virtual void FixedUpdate ()
 
virtual void LateUpdate ()
 
virtual void SetTrackingHeightToAvatar ()
 
virtual void CalculateMovement ()
 
virtual void CalculateMovement2 ()
 
virtual void Fall ()
 
virtual void CheckGround ()
 
virtual void CheckGrounded ()
 
virtual void CheckGroundMovement ()
 
virtual void CalculateVelocity ()
 

Protected Attributes

MatchingType avatarMatching = MatchingType.SetHeightToCharacter
 Scale Tracking to Avatar scales the tracking input to match the size of the avatar More...
 
CharacterController characterController
 
PawnHead _headTarget
 
PawnHand _leftHandTarget
 
PawnHand _rightHandTarget
 
Transform _realWorld
 
Tracker[] _trackers
 
Vector3 gravitationalVelocity
 
Vector3 inputMovement = Vector3.zero
 
Transform lastGround
 
Vector3 lastGroundPosition = Vector3.zero
 
float lastGroundAngle = 0
 
float lastVelocityTime
 
Vector3 lastPosition
 

Properties

virtual float neckHeight [get]
 
virtual float height [get]
 
virtual float radius [get]
 
PawnHead headTarget [get]
 The camera of the pawn. When using VR this is the HMD More...
 
PawnHand leftHandTarget [get]
 The left (side side of) controller More...
 
PawnHand rightHandTarget [get]
 The right (side of the) controller More...
 
Transform realWorld [get]
 The transform containing all real-world objects More...
 
Tracker[] trackers [get]
 All available trackers for this pawn More...
 

Detailed Description

Controls players using controller input

Member Enumeration Documentation

◆ StartPosition

Types of startposition for the Pawn

◆ MatchingType

Options for matching the player to the game character

◆ TargetId

Member Function Documentation

◆ Calibrate()

virtual void Passer.Pawn.PawnControl.Calibrate ( )
virtual

Calibrates the tracking with the player

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ AdjustTracking()

virtual void Passer.Pawn.PawnControl.AdjustTracking ( Vector3  delta)
virtual

Adjust the tracking origin of all trackers

Parameters
deltaThe translation to apply to the tracking origin

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ MoveForward()

virtual void Passer.Pawn.PawnControl.MoveForward ( float  z)
virtual

Move the Pawn forward with the given speed

Parameters
zThe forward movement speed in units(meters) per second. Negative value result in backward movement

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ MoveSideward()

virtual void Passer.Pawn.PawnControl.MoveSideward ( float  x)
virtual

Move the Parn sideward (left/right) with the given speed

Parameters
xThe movement speed in units(meters) per second. Positive values move the pawn to the right (in local space). Negative value move the pawn to the left.

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ Stop()

virtual void Passer.Pawn.PawnControl.Stop ( )
virtual

Stop any translational movement of the Pawn

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ Rotate()

virtual void Passer.Pawn.PawnControl.Rotate ( float  angularSpeed)
virtual

Rotate the pawn

Rotates the pawn along the Y axis

Parameters
angularSpeedThe speed in degrees per second

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ Rotation()

virtual void Passer.Pawn.PawnControl.Rotation ( float  yAngle)
virtual

Set the rotation angle along Y axis

Reimplemented in Passer.Humanoid.HumanoidControl.

◆ RotateTo()

IEnumerator Passer.Pawn.PawnControl.RotateTo ( Quaternion  targetRotation)

Rotation animation to reach the given rotation

The speed of the rotation is determined by the rotationSpeed

Parameters
targetRotationThe target rotation

◆ LookAt()

IEnumerator Passer.Pawn.PawnControl.LookAt ( Vector3  targetPosition)

Rotation animation to look at the given position

The speed of the rotation is determined by the rotationSpeed

Parameters
targetPositionThe position to look at
Returns

◆ WalkTo() [1/2]

IEnumerator Passer.Pawn.PawnControl.WalkTo ( Vector3  targetPosition)

Movement animation to reach the given position

The pawn will walk to the given position. The speed of the movement is determined by forwardSpeed. Any required rotation will be limited by rotationSpeed

Parameters
targetPositionThe position to where the pawn should walk
Returns

◆ WalkTo() [2/2]

IEnumerator Passer.Pawn.PawnControl.WalkTo ( Vector3  targetPosition,
Quaternion  targetRotation 
)

Movement animation to reach the given position and rotation

The pawn will walk to the given position and rotation. The speed of the movement is determined by forwardSpeed. Any required rotation will be limited by rotationSpeed

Parameters
targetPositionThe position to where the pawn should walk
targetRotationThe rotation the pawn should have at the end
Returns

◆ Jump()

virtual void Passer.Pawn.PawnControl.Jump ( float  takeoffVelocity)
virtual

Let the pawn jump

<param name="takeoffVelocity>The takeoff velocity of the jump

Reimplemented in Passer.Humanoid.HumanoidControl.

Member Data Documentation

◆ showRealObjects

bool Passer.Pawn.PawnControl.showRealObjects = true

If true, real world objects like controllers and cameras are shown in the scene

◆ physics

bool Passer.Pawn.PawnControl.physics = true

Enables controller physics and collisions during walking.

◆ useGravity

bool Passer.Pawn.PawnControl.useGravity = true

If there is not static object below the feet of the avatar the avatar will fall down until it reaches solid ground

◆ stepOffset

float Passer.Pawn.PawnControl.stepOffset = 0.3F

The maximum height of objects of the ground which do not stop the humanoid

◆ bodyPull

bool Passer.Pawn.PawnControl.bodyPull = false

Will move the pawn position when grabbing handles on static objects

◆ proximitySpeed

bool Passer.Pawn.PawnControl.proximitySpeed = false

Reduces the walking speed of the humanoid when in the neighbourhood of objects to reduce motion sickness.

◆ proximitySpeedRate

float Passer.Pawn.PawnControl.proximitySpeedRate = 0.8f

The amount of influence of the proximity speed. 1=No influence, 0 = Maximum

◆ startPosition

StartPosition Passer.Pawn.PawnControl.startPosition = StartPosition.AvatarPosition

The start position of the humanoid

◆ avatarMatching

MatchingType Passer.Pawn.PawnControl.avatarMatching = MatchingType.SetHeightToCharacter
protected

Scale Tracking to Avatar scales the tracking input to match the size of the avatar

◆ calibrateAtStart

bool Passer.Pawn.PawnControl.calibrateAtStart = false

Perform a calibration when the scene starts

◆ dontDestroyOnLoad

bool Passer.Pawn.PawnControl.dontDestroyOnLoad = false

Sets the Don't Destoy On Load such that the pawn survives scene changes

◆ forwardSpeed

float Passer.Pawn.PawnControl.forwardSpeed = 1

maximum forward speed in units(meters)/second

◆ backwardSpeed

float Passer.Pawn.PawnControl.backwardSpeed = 0.6F

maximum backward speed in units(meters)/second

◆ sidewardSpeed

float Passer.Pawn.PawnControl.sidewardSpeed = 1

maximum sideways speed in units(meters)/second

◆ maxAcceleration

float Passer.Pawn.PawnControl.maxAcceleration = 1

maximum acceleration in units(meters)/second/second value 0 = no maximum acceleration

◆ rotationSpeed

float Passer.Pawn.PawnControl.rotationSpeed = 60

maximum rotational speed in degrees/second

◆ velocity

Vector3 Passer.Pawn.PawnControl.velocity

The current velocity of the Pawn

◆ ground

Transform Passer.Pawn.PawnControl.ground

The ground Transform on which the pawn is standing

When the pawn is not standing on the ground, the value is null

◆ groundVelocity

Vector3 Passer.Pawn.PawnControl.groundVelocity

The velocity of the ground on which the pawn is standing

◆ groundAngularVelocity

float Passer.Pawn.PawnControl.groundAngularVelocity

The angular velocity of the ground on which the pawn is standing

The velocity is in degrees per second along the Y axis of the pawn

◆ networking

IPawnNetworking Passer.Pawn.PawnControl.networking

The networking interface

◆ isRemote

bool Passer.Pawn.PawnControl.isRemote = false

Is true when this is a remote pawn

Remote pawns are not controlled locally, but are controlled from another computer. These are copies of the pawn on that other computer and are updated via messages exchanges on a network.

◆ nwId

ulong Passer.Pawn.PawnControl.nwId

The Id of this pawn across the network

◆ id

int Passer.Pawn.PawnControl.id = -1

The local Id of this humanoid

Property Documentation

◆ headTarget

PawnHead Passer.Pawn.PawnControl.headTarget
get

The camera of the pawn. When using VR this is the HMD

◆ leftHandTarget

PawnHand Passer.Pawn.PawnControl.leftHandTarget
get

The left (side side of) controller

/// For game controllers this includes the buttons and controls operated by the left hand.

◆ rightHandTarget

PawnHand Passer.Pawn.PawnControl.rightHandTarget
get

The right (side of the) controller

For game controllers this includes the buttons and controls operated by the right hand.

◆ realWorld

Transform Passer.Pawn.PawnControl.realWorld
get

The transform containing all real-world objects

◆ trackers

Tracker [] Passer.Pawn.PawnControl.trackers
get

All available trackers for this pawn


The documentation for this class was generated from the following file: