Humanoid Control for Unity  v3
Passer.TeleportTarget Class Reference

The Teleport Target provides control to where a player can teleport and can be used in combination with a generic Interaction Pointer. More...

Inherits EventTrigger.

Public Types

enum  TargetPosRot { Pointer, Transform }
 

Public Member Functions

void TeleportToHere (Transform t)
 Teleport the transform to this Teleport Target. More...
 
void TeleportToHere (HumanoidControl humanoid)
 Teleport the Humanoid to this Teleport Target. More...
 
override void OnPointerDown (PointerEventData eventData)
 Teleporting initialized by an Unity UI Event. More...
 

Public Attributes

bool teleportRoot = false
 Teleport the root transform instead of the transform itself. More...
 
bool checkCollision = true
 Check the target location for collisions. More...
 
MovementType movementType
 The type of movement used to reacht the teleport target. More...
 
TargetPosRot targetPosRot = TargetPosRot.Pointer
 Determines the target position and rotation. More...
 
Transform targetTransform
 The target transform for the teleport. More...
 
Pose pose
 The pose of a humanoid after it has been teleported. More...
 
bool enableAnimators = true
 Enables humanoid animators after teleporting. More...
 
UnityEvent unityEvents
 

Protected Member Functions

virtual void Teleport (Transform transform, Vector3 position, Quaternion rotation, MovementType movementType=MovementType.Teleport, Transform newParent=null)
 Teleport the transform to a position and rotation. More...
 
virtual bool IsValid (Vector3 position)
 Check is the target position is valid. More...
 

Detailed Description

The Teleport Target provides control to where a player can teleport and can be used in combination with a generic Interaction Pointer.


The Teleport Target can be placed on a static or moving Rigidbody object with a collider. It has been implemented as a Event Trigger and will teleport when an PointerDown event is received.

Member Function Documentation

◆ TeleportToHere() [1/2]

void Passer.TeleportTarget.TeleportToHere ( Transform  t)

Teleport the transform to this Teleport Target.

This function will teleport the given transform to this teleport target using the teleport target settings. If the targetPosRot is set to TargetPosRot.Pointer, the transform will be transported using the transform of the gameObject as there is no pointer information.

Parameters
tThe transform to teleport

◆ TeleportToHere() [2/2]

void Passer.TeleportTarget.TeleportToHere ( HumanoidControl  humanoid)

Teleport the Humanoid to this Teleport Target.

This function will teleport the given humanoid to this teleport target using the teleport target settings. If the targetPosRot is set to TargetPosRot.Pointer, the humanoid will be transported using the transform of the gameObject as there is no pointer information.

Parameters
humanoidThe humanoid to teleport

◆ OnPointerDown()

override void Passer.TeleportTarget.OnPointerDown ( PointerEventData  eventData)

Teleporting initialized by an Unity UI Event.

◆ Teleport()

virtual void Passer.TeleportTarget.Teleport ( Transform  transform,
Vector3  position,
Quaternion  rotation,
MovementType  movementType = MovementType.Teleport,
Transform  newParent = null 
)
protectedvirtual

Teleport the transform to a position and rotation.

This function will teleport the given transform to this teleport target using the teleport target settings. If the targetPosRot is set to TargetPosRot.Pointer, the transform will be transported using the transform of the gameObject as there is no pointer information.

Parameters
transformThe transform to teleport
positionThe new world position of the transform after teleporting
rotationThe new world rotation of the transform after teleporting
movementTypeThe movement type to use to get to the target
newParentThe new parent of the transform after teleporting

◆ IsValid()

virtual bool Passer.TeleportTarget.IsValid ( Vector3  position)
protectedvirtual

Check is the target position is valid.

Member Data Documentation

◆ teleportRoot

bool Passer.TeleportTarget.teleportRoot = false

Teleport the root transform instead of the transform itself.

If this is enabled the root of the transform (the topmost transform) will be teleported instead of the transform itself.

◆ checkCollision

bool Passer.TeleportTarget.checkCollision = true

Check the target location for collisions.

if enabled this will check if the location to which the pointer is pointing contains a collider. Teleporting will only take place if no collider has been found. The check is executed using a capsule of 2 meters/units high and 0.2 meters/units radius.

◆ movementType

MovementType Passer.TeleportTarget.movementType

The type of movement used to reacht the teleport target.

determines how the Transform is moved to the Target Point. Teleport = direct placement a the target point. Dash = a quick movement is a short time from the originating point to the target point.

◆ targetPosRot

TargetPosRot Passer.TeleportTarget.targetPosRot = TargetPosRot.Pointer

Determines the target position and rotation.

TargetPosRot.Pointer = The interaction pointer location is the target position and rotation. TargetPosRot.Transform = The targetTransform determines the target position and rototation.

◆ targetTransform

Transform Passer.TeleportTarget.targetTransform

The target transform for the teleport.

If targetPosRot is set to TargetPosRot.Transform the targetTransform will determine the position and rotation of the transform to teleport. Next to that, the teleported transform will become a child of this teleportTarget after teleporting

◆ pose

Pose Passer.TeleportTarget.pose

The pose of a humanoid after it has been teleported.

This is an optional Pose of the Humanoid after it has been teleported. This enables you to teleport to a different pose like a seating pose for instance.

◆ enableAnimators

bool Passer.TeleportTarget.enableAnimators = true

Enables humanoid animators after teleporting.

This will enable or disable the hips and foot animator after teleporting. For poses like seating a walking foot animation is not required. In such cases the foot animator can be switch off with this setting.


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