Photon Bolt Engine API 1.3

Properties | List of all members
Photon.Bolt.LagCompensation.BoltHitbox Class Reference

Defines one hitbox on a BoltHitboxBody More...

Inheritance diagram for Photon.Bolt.LagCompensation.BoltHitbox:

Properties

Vector3 hitboxBoxSize [get, set]
 Size of the hitbox if this shape is a box More...
 
Vector3 hitboxCenter [get, set]
 Center of the hitbox in local coordinates More...
 
BoltHitboxShape hitboxShape [get, set]
 Shape of the hitbox (box or sphere) More...
 
float hitboxSphereRadius [get, set]
 Type of the hitbox More...
 
BoltHitboxType hitboxType [get, set]
 Type of the hitbox More...
 

Detailed Description

Defines one hitbox on a BoltHitboxBody

Example: Resizing a sphere hitbox

void ResizeSphereHitbox(BoltHitbox hitbox, float newRadius) {
if(hitbox.hitboxShape != BoltHitboxShape.Sphere) {
Debug.Log("Attemping to resize a non-sphere hitbox");
return;
}
hitbox.hitboxSphereRadius = newRadius;
}

Property Documentation

◆ hitboxBoxSize

Vector3 Photon.Bolt.LagCompensation.BoltHitbox.hitboxBoxSize
getset

Size of the hitbox if this shape is a box

Example: A method to double the size of a player's head hitbox if it is a box.

void DoubleHeadSize(BoltHitboxBody body) {
foreach(BoltHitbox hitbox in body.hitboxes) {
if(hitbox.hitboxType == BoltHitboxType.Head) {
hitbox.hitboxBoxSize = hitbox.hitboxBoxSize * 2f;
}
}
}

◆ hitboxCenter

Vector3 Photon.Bolt.LagCompensation.BoltHitbox.hitboxCenter
getset

Center of the hitbox in local coordinates

Example: Getting a vector that points from the player's weapon to the head of a target entity.

Vector3 GetHeadshotVector(BoltEntity target, IWeapon currentWeapon) {
BoltHitboxBody body = target.GetComponent<BoltHitboxBody%gt();
BoltHitbox head = body.hitboxes[0];
foreach(BoltHitbox hitbox in body.hitboxes) {
if(hitbox.hitboxType == BoltHitboxType.Head) {
head = hitbox;
}
}
return head.hitboxCenter - currentWeapon.fireOrigin;
}

◆ hitboxShape

BoltHitboxShape Photon.Bolt.LagCompensation.BoltHitbox.hitboxShape
getset

Shape of the hitbox (box or sphere)

Example: Sorting the hitboxes in a body based on shape.

void ConfigureHitboxes(BoltHitboxBody body) {
foreach(BoltHitbox hitbox in body.hitboxes) {
switch(hitbox.hitboxShape) {
case BoltHitboxShape.Sphere: ConfigureSphere(hitbox); break;
case BoltHitboxShape.Box: ConfigureBox(hitbox); break;
}
}
}

///

◆ hitboxSphereRadius

float Photon.Bolt.LagCompensation.BoltHitbox.hitboxSphereRadius
getset

Type of the hitbox

Example: A method to double the size of a player's head hitbox if it is a sphere.

void DoubleHeadSize(BoltHitboxBody body) {
foreach(BoltHitbox hitbox in body.hitboxes) {
if(hitbox.hitboxType == BoltHitboxType.Head) {
hitbox.hitboxSphereRadius = hitbox.hitboxSphereRadius * 2f;
}
}
}

◆ hitboxType

BoltHitboxType Photon.Bolt.LagCompensation.BoltHitbox.hitboxType
getset

Type of the hitbox

Example: Modifying a base damage value depending on the area of the hit.

float CalculateDamage(BoltHitbox hit, float baseDamage) {
switch(hit.hitboxType) {
case BoltHitboxType.Head: return 2.0f * baseDamage;
case BoltHitboxType.Leg:
case BoltHitboxType.UpperArm: return 0.7f * baseDamage;
default: return baseDamage;
}
}
Photon.Bolt.LagCompensation.BoltHitboxShape
BoltHitboxShape
What type of shape to use in a bolt hitbox
Definition: BoltHitboxShape.cs:22
Photon.Bolt.LagCompensation.BoltHitboxType
BoltHitboxType
The body area represented by a bolt hitbox
Definition: BoltHitboxType.cs:24