Photon Bolt Engine API
Networking Middleware
Public Attributes | List of all members
BoltPhysicsHit Struct Reference

Describes a hit to a BoltHitbox on a BoltHitboxBody More...

Public Attributes

float distance
 The distance away from the origin of the ray More...
 
BoltHitbox hitbox
 Which hitbox was hit More...
 
BoltHitboxBody body
 The body which was hit More...
 

Detailed Description

Describes a hit to a BoltHitbox on a BoltHitboxBody

Example: Logging the details of a BoltPhysicsHit object.

1 void FireWeaponOwner(PlayerCommand cmd, BoltEntity entity) {
2  if(entity.isOwner) {
3  using(BoltPhysicsHits hits = BoltNetwork.RaycastAll(new Ray(entity.transform.position, cmd.Input.targetPos),
4  cmd.ServerFrame))0 {
5 
6  if(hit.count > 0) {
7  BoltPhysicsHit hit = hits.GetHit(0);
8  Debug.Log(string.Format("[HIT] Target={0}, Distance={1}, HitArea={2}", hit.body.gameObject.name, hit.distance, hit.hitbox.hitboxType);
9  }
10  }
11  }
12 }

Member Data Documentation

BoltHitboxBody BoltPhysicsHit.body

The body which was hit

float BoltPhysicsHit.distance

The distance away from the origin of the ray

BoltHitbox BoltPhysicsHit.hitbox

Which hitbox was hit