Third Person Cover Shooter  1.6
CoverShooter.Cover Class Reference

Walls usable for taking covers have to be marked by cover markers. More...

Inheritance diagram for CoverShooter.Cover:

Public Member Functions

bool IsLeftAdjacent (Cover cover, Vector3 position)
 Is the given cover adjacent to the left at the given position. More...
 
bool IsRightAdjacent (Cover cover, Vector3 position)
 Is the given cover adjacent to the right at the given position. More...
 
CoverClimb GetClimbAt (Vector3 position, float radius, float maxClimbHeight, float maxVaultHeight, float maxVaultDistance)
 Returns the type of possible climb at the given position. More...
 
void RegisterUser (Actor actor, Vector3 position)
 Adds an AI as a user to the cover. More...
 
void UnregisterUser (Actor actor)
 Removes an AI from the cover users. More...
 
bool CheckTall (float observer)
 Return whether the cover is considered for an observer with given y coordinate. More...
 
bool IsInFront (Vector3 observer, bool isOld)
 Returns true if the given position is in front of the cover. More...
 
Vector3 LeftCorner (float y, float offset=0)
 Returns the position of the left corner with the given height coordinate. More...
 
Vector3 RightCorner (float y, float offset=0)
 Returns the position of the right corner with the given height coordinate. More...
 
bool IsByLeftCorner (Vector3 position, float distance)
 Returns true if the given position is within the given distance of the left corner. More...
 
bool IsByRightCorner (Vector3 position, float distance)
 Returns true if the given position is within the given distance of the right corner. More...
 
int ClosestCornerToSegment (Vector3 a, Vector3 b, float radius, out Vector3 position)
 Returns the cloest corner to a segment. More...
 
int ClosestCornerTo (Vector3 point, float radius, out Vector3 position)
 Returns the closest corner useful for aiming. More...
 
Vector3 ClosestPointTo (Vector3 point, float sideRadius, float frontRadius)
 Returns a position on a cover closest to the given point. More...
 
Vector3 ClosestPointTo (Vector3 point, float leftSideRadius, float rightSideRadius, float frontRadius)
 Returns a position on a cover closest to the given point. More...
 
bool IsFrontField (float angle, float field)
 Returns true if a given angle is pointing towards the front of the cover. More...
 
bool IsFront (float angle, float margin=0)
 Returns true if a given angle is pointing towards the front of the cover. More...
 
bool IsBack (float angle, float margin=0)
 Returns true if a given angle is pointing backwards from the cover. More...
 
bool IsLeft (float angle, float margin=0)
 Returns true if a given angle is pointing left of the cover. More...
 
bool IsLeftField (float angle, float field)
 Returns true if a given angle is pointing left of the cover. More...
 
bool IsRight (float angle, float margin=0)
 Returns true if a given angle is pointing right of the cover. More...
 
bool IsRightField (float angle, float field)
 Returns true if a given angle is pointing right of the cover. More...
 

Public Attributes

const float TallThreshold = 1.2f
 Minimal distance from characters feet to the top of a cover for it to be considered tall. More...
 
bool OpenLeft = true
 Can the character use the left corner of the cover. More...
 
bool OpenRight = true
 Can the character use the rgiht corner of the cover. More...
 
float AdjacentDistance = 1
 Maximum allowed distance to adjacent covers. More...
 

Properties

IEnumerable< CoverUserUsers [get]
 Returns all AI users of the cover. More...
 
float Top [get]
 Y coordinate of the cover top in world space. More...
 
float Bottom [get]
 Y coordinate of the cover bottom in world space. More...
 
Vector3 Forward [get]
 Direction pointing towards the wall. More...
 
Vector3 Right [get]
 Direction pointing right from a character along the wall. More...
 
Vector3 Left [get]
 Direction pointing left from a character along the wall. More...
 
float Angle [get]
 Orientation of the cover in degrees in world space. More...
 
float Width [get]
 Width of the cover. More...
 
float Height [get]
 Height of the cover. More...
 
float Depth [get]
 Depth of the cover. More...
 
Cover LeftAdjacent [get]
 Cover to the left. More...
 
Cover RightAdjacent [get]
 Cover to the right. More...
 
bool IsTall [get]
 Returns whether the cover is considered for an observer standing at the same level as the cover. More...
 

Detailed Description

Walls usable for taking covers have to be marked by cover markers.

A cover marker is any gameobject with Cover and Box Collider components attached. Markers can intersect, form a chain which is interpreted as one big cover by character motors. Cover orientation matters, the example scene contains markers with feet that mark facing directions. There are two kinds of covers, low and tall. The kind is determined from the height of a BoxCollider attached to the marker. The height threshold is different for every character and is defined by a Character Motor. The character will correctly change its stance when moving between tall and low covers. A corner of a tall cover with no adjacent tall covers nearby is treated as a corner characters can peek from. However, there can be unmarked walls and therefore character can attempt to take a peek in impossible situations. Such cases are handled by Open Left and Open Right properties inside the Cover component, setting a value to false marks that corner as unusable for peeking. Covers can be climbed or vaulted over. Upon request, character motor will calculate if a climb is possible and perform it at the correct height. If the wall is low and thin enough to be jumped over, the character will perform a vault.

Member Function Documentation

◆ CheckTall()

bool CoverShooter.Cover.CheckTall ( float  observer)

Return whether the cover is considered for an observer with given y coordinate.

◆ ClosestCornerTo()

int CoverShooter.Cover.ClosestCornerTo ( Vector3  point,
float  radius,
out Vector3  position 
)

Returns the closest corner useful for aiming.

◆ ClosestCornerToSegment()

int CoverShooter.Cover.ClosestCornerToSegment ( Vector3  a,
Vector3  b,
float  radius,
out Vector3  position 
)

Returns the cloest corner to a segment.

◆ ClosestPointTo() [1/2]

Vector3 CoverShooter.Cover.ClosestPointTo ( Vector3  point,
float  sideRadius,
float  frontRadius 
)

Returns a position on a cover closest to the given point.

◆ ClosestPointTo() [2/2]

Vector3 CoverShooter.Cover.ClosestPointTo ( Vector3  point,
float  leftSideRadius,
float  rightSideRadius,
float  frontRadius 
)

Returns a position on a cover closest to the given point.

◆ GetClimbAt()

CoverClimb CoverShooter.Cover.GetClimbAt ( Vector3  position,
float  radius,
float  maxClimbHeight,
float  maxVaultHeight,
float  maxVaultDistance 
)

Returns the type of possible climb at the given position.

◆ IsBack()

bool CoverShooter.Cover.IsBack ( float  angle,
float  margin = 0 
)

Returns true if a given angle is pointing backwards from the cover.

Parameters
angleDegrees in world space.
marginReduction in each side of the back arc of the cover.

◆ IsByLeftCorner()

bool CoverShooter.Cover.IsByLeftCorner ( Vector3  position,
float  distance 
)

Returns true if the given position is within the given distance of the left corner.

◆ IsByRightCorner()

bool CoverShooter.Cover.IsByRightCorner ( Vector3  position,
float  distance 
)

Returns true if the given position is within the given distance of the right corner.

◆ IsFront()

bool CoverShooter.Cover.IsFront ( float  angle,
float  margin = 0 
)

Returns true if a given angle is pointing towards the front of the cover.

Parameters
angleDegrees in world space.
marginReduction in each side of the front arc of the cover.

◆ IsFrontField()

bool CoverShooter.Cover.IsFrontField ( float  angle,
float  field 
)

Returns true if a given angle is pointing towards the front of the cover.

Parameters
angleDegrees in world space.
fieldField of the front. 180 equals half a circle.

◆ IsInFront()

bool CoverShooter.Cover.IsInFront ( Vector3  observer,
bool  isOld 
)

Returns true if the given position is in front of the cover.

Parameters
isOldOld positions use lesser thresholds.

◆ IsLeft()

bool CoverShooter.Cover.IsLeft ( float  angle,
float  margin = 0 
)

Returns true if a given angle is pointing left of the cover.

◆ IsLeftAdjacent()

bool CoverShooter.Cover.IsLeftAdjacent ( Cover  cover,
Vector3  position 
)

Is the given cover adjacent to the left at the given position.

◆ IsLeftField()

bool CoverShooter.Cover.IsLeftField ( float  angle,
float  field 
)

Returns true if a given angle is pointing left of the cover.

◆ IsRight()

bool CoverShooter.Cover.IsRight ( float  angle,
float  margin = 0 
)

Returns true if a given angle is pointing right of the cover.

◆ IsRightAdjacent()

bool CoverShooter.Cover.IsRightAdjacent ( Cover  cover,
Vector3  position 
)

Is the given cover adjacent to the right at the given position.

◆ IsRightField()

bool CoverShooter.Cover.IsRightField ( float  angle,
float  field 
)

Returns true if a given angle is pointing right of the cover.

◆ LeftCorner()

Vector3 CoverShooter.Cover.LeftCorner ( float  y,
float  offset = 0 
)

Returns the position of the left corner with the given height coordinate.

◆ RegisterUser()

void CoverShooter.Cover.RegisterUser ( Actor  actor,
Vector3  position 
)

Adds an AI as a user to the cover.

◆ RightCorner()

Vector3 CoverShooter.Cover.RightCorner ( float  y,
float  offset = 0 
)

Returns the position of the right corner with the given height coordinate.

◆ UnregisterUser()

void CoverShooter.Cover.UnregisterUser ( Actor  actor)

Removes an AI from the cover users.

Member Data Documentation

◆ AdjacentDistance

float CoverShooter.Cover.AdjacentDistance = 1

Maximum allowed distance to adjacent covers.

◆ OpenLeft

bool CoverShooter.Cover.OpenLeft = true

Can the character use the left corner of the cover.

◆ OpenRight

bool CoverShooter.Cover.OpenRight = true

Can the character use the rgiht corner of the cover.

◆ TallThreshold

const float CoverShooter.Cover.TallThreshold = 1.2f

Minimal distance from characters feet to the top of a cover for it to be considered tall.

Property Documentation

◆ Angle

float CoverShooter.Cover.Angle
get

Orientation of the cover in degrees in world space.

◆ Bottom

float CoverShooter.Cover.Bottom
get

Y coordinate of the cover bottom in world space.

◆ Depth

float CoverShooter.Cover.Depth
get

Depth of the cover.

◆ Forward

Vector3 CoverShooter.Cover.Forward
get

Direction pointing towards the wall.

◆ Height

float CoverShooter.Cover.Height
get

Height of the cover.

◆ IsTall

bool CoverShooter.Cover.IsTall
get

Returns whether the cover is considered for an observer standing at the same level as the cover.

◆ Left

Vector3 CoverShooter.Cover.Left
get

Direction pointing left from a character along the wall.

◆ LeftAdjacent

Cover CoverShooter.Cover.LeftAdjacent
get

Cover to the left.

◆ Right

Vector3 CoverShooter.Cover.Right
get

Direction pointing right from a character along the wall.

◆ RightAdjacent

Cover CoverShooter.Cover.RightAdjacent
get

Cover to the right.

◆ Top

float CoverShooter.Cover.Top
get

Y coordinate of the cover top in world space.

◆ Users

IEnumerable<CoverUser> CoverShooter.Cover.Users
get

Returns all AI users of the cover.

◆ Width

float CoverShooter.Cover.Width
get

Width of the cover.


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