Photon Fusion 2.1.1

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.
void SetLayer (int layer)
 Set a layer mask for this Hitbox gameobject. This method caches the layer mask.
Public Member Functions inherited from Behaviour
AddBehaviour< T > ()
 Wrapper for Unity's GameObject.AddComponent().
GetBehaviour< T > ()
 Wrapper for Unity's GameObject.GetComponentInChildren().
bool TryGetBehaviour< T > (out T behaviour)
 Wrapper for Unity's GameObject.TryGetComponent().

Public Attributes

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

Protected Member Functions

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

Properties

int ColliderIndex [get]
 Index assigned to the collider of this hitbox on the lag-compensated snapshots.
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.
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.
Vector3 Position [get]
 World-space position (includes Offset) of this Hitbox.

Additional Inherited Members

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

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

◆ SetLayer()

void SetLayer ( int layer)

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

Parameters
layer