Photon Fusion 2.0.3

Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Hitbox Class Reference

Represents a single lag-compensated collider. Multiple component instances can be added anywhere in the hierarchy of a NetworkObject which includes a HitboxRoot. More...

Inherits Behaviour.

Public Member Functions

void OnDrawGizmos ()
 Draws this hitbox gizmo on Unity editor. More...
 
void SetLayer (int layer)
 Set a layer mask for this Hitbox gameobject. This method caches the layer mask. More...
 
- Public Member Functions inherited from Behaviour
AddBehaviour< T > ()
 Wrapper for Unity's GameObject.AddComponent() More...
 
GetBehaviour< T > ()
 Wrapper for Unity's GameObject.GetComponentInChildren() More...
 
bool TryGetBehaviour< T > (out T behaviour)
 Wrapper for Unity's GameObject.TryGetComponent() More...
 

Public Attributes

Vector3 BoxExtents
 When Type is set to HitboxTypes.Box, this defines the local-space geometry for narrow-phase checks. More...
 
float CapsuleExtents
 When Type is set to HitboxTypes.Capsule, this defines the local-space geometry for narrow-phase checks. More...
 
float CapsuleRadius
 When Type is set to HitboxTypes.Capsule, this defines the local-space geometry for narrow-phase checks. More...
 
Color GizmosColor = Color.yellow
 Color used when drawing gizmos for this hitbox. More...
 
Vector3 Offset
 This Hitbox's local-space offset from its GameObject position. More...
 
HitboxRoot Root
 Reference to the top-level HitboxRoot component for this NetworkObject. More...
 
float SphereRadius
 When Type is set to HitboxTypes.Sphere, this defines the local-space geometry for narrow-phase checks. More...
 
HitboxTypes Type
 The collision geometry type for this Hitbox. More...
 

Protected Member Functions

virtual void DrawGizmos (Color color, ref Matrix4x4 localToWorldMatrix)
 Draw the Hitbox gizmos. More...
 

Properties

int ColliderIndex [get]
 Index assigned to the collider of this hitbox on the lag-compensated snapshots. More...
 
bool HitboxActive [get, set]
 Get or set the state of this Hitbox. If a hitbox or its HitboxRoot are not active, it will not be hit by lag-compensated queries. More...
 
Int32 HitboxIndex [get]
 The index of this hitbox in the HitboxRoot.Hitboxes array on Root. The value is set by the root when initializing the nested hitboxes with HitboxRoot.InitHitboxes. More...
 
Vector3 Position [get]
 World-space position (includes Offset) of this Hitbox. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Behaviour
static void DestroyBehaviour (Behaviour behaviour)
 Wrapper for Unity's GameObject.Destroy() More...
 

Detailed Description

Represents a single lag-compensated collider. Multiple component instances can be added anywhere in the hierarchy of a NetworkObject which includes a HitboxRoot.

Member Function Documentation

◆ DrawGizmos()

virtual void DrawGizmos ( Color  color,
ref Matrix4x4  localToWorldMatrix 
)
protectedvirtual

Draw the Hitbox gizmos.

◆ OnDrawGizmos()

void OnDrawGizmos ( )

Draws this hitbox gizmo on Unity editor.

◆ SetLayer()

void SetLayer ( int  layer)

Set a layer mask for this Hitbox gameobject. This method caches the layer mask.

Parameters
layer

Member Data Documentation

◆ BoxExtents

Vector3 BoxExtents

When Type is set to HitboxTypes.Box, this defines the local-space geometry for narrow-phase checks.

◆ CapsuleExtents

float CapsuleExtents

When Type is set to HitboxTypes.Capsule, this defines the local-space geometry for narrow-phase checks.

◆ CapsuleRadius

float CapsuleRadius

When Type is set to HitboxTypes.Capsule, this defines the local-space geometry for narrow-phase checks.

◆ GizmosColor

Color GizmosColor = Color.yellow

Color used when drawing gizmos for this hitbox.

◆ Offset

Vector3 Offset

This Hitbox's local-space offset from its GameObject position.

◆ Root

HitboxRoot Root

Reference to the top-level HitboxRoot component for this NetworkObject.

◆ SphereRadius

float SphereRadius

When Type is set to HitboxTypes.Sphere, this defines the local-space geometry for narrow-phase checks.

◆ Type

The collision geometry type for this Hitbox.

Property Documentation

◆ ColliderIndex

int ColliderIndex
get

Index assigned to the collider of this hitbox on the lag-compensated snapshots.

◆ HitboxActive

bool HitboxActive
getset

Get or set the state of this Hitbox. If a hitbox or its HitboxRoot are not active, it will not be hit by lag-compensated queries.

◆ HitboxIndex

Int32 HitboxIndex
get

The index of this hitbox in the HitboxRoot.Hitboxes array on Root. The value is set by the root when initializing the nested hitboxes with HitboxRoot.InitHitboxes.

◆ Position

Vector3 Position
get

World-space position (includes Offset) of this Hitbox.