Photon Quantum 3.0.0

Classes | Public Attributes | Properties | List of all members
Quantum.CollisionInfo3D Struct Reference

Info about a collision between two 3D physics colliders. More...

Classes

struct  ContactPointIterator3D
 An iterator over multiple triangles collisions with a given mesh. More...
 
struct  TriangleCollisionInfo
 Info about the collision with a specific triangle of a mesh. More...
 
struct  TriangleCollisionIterator
 Data regarding a mesh collision, including all the individual triangles. More...
 

Public Attributes

ContactPointIterator3D ContactPoints
 Data about the contact points of the collision. More...
 
TriangleCollisionIterator MeshTriangleCollisions
 Additional data regarding a mesh collision, including all the individual triangles. To know if this is a mesh collision, check IsMeshCollision. More...
 

Properties

FPVector3 ContactNormal [get]
 The contact normal, from the Entity perspective. More...
 
EntityRefEntity [get]
 The main entity involved in the collision. More...
 
UInt16? EntityShapeUserTag [get]
 The Shape3D.UserTag of the entity's shape involved in the collision. More...
 
Boolean IgnoreCollision [get, set]
 If the collision should be ignored by the physics engine. More...
 
bool IsMeshCollision [get]
 If the Entity is colliding with a static mesh. More data about the mesh collision, including individual triangle collisions, can be accessed in MeshTriangleCollisions. More...
 
bool IsStatic [get]
 If the Entity is touching a static collider. If so, Other has an EntityRef.None value and the static collider data can be accessed through StaticData. More...
 
EntityRefOther [get]
 The other entity involved in the collision if the Entity is NOT colliding with a static (check IsStatic). More...
 
UInt16?? OtherShapeUserTag [get]
 The Shape3D.UserTag of the other entity's shape involved in the collision. Returns default value if the this is a static collision. More...
 
FPPenetration [get]
 The collision penetration in the ContactNormal direction. More...
 
StaticColliderData StaticData [get]
 The StaticColliderData if the Entity is colliding with a static (check IsStatic). More...
 

Detailed Description

Info about a collision between two 3D physics colliders.

The info is taken from the perspective of the entity that has subscribed to the callback with Quantum.Physics3D.PhysicsEngine3D.SetCallbacks.

If both entities involved in a collision have subscribed to this collision type callback, it will be called twice, each time carrying information from the perspective of one of the entities.

See CollisionInfo2D for 2D collisions and TriggerInfo3D for 3D trigger collisions.

Member Data Documentation

◆ ContactPoints

ContactPointIterator3D Quantum.CollisionInfo3D.ContactPoints

Data about the contact points of the collision.

◆ MeshTriangleCollisions

TriangleCollisionIterator Quantum.CollisionInfo3D.MeshTriangleCollisions

Additional data regarding a mesh collision, including all the individual triangles. To know if this is a mesh collision, check IsMeshCollision.

if (info.IsMeshCollision) { Log.Info($"Average normal: {info.MeshTriangleCollisions.AverageNormal}"); while(info.MeshTriangleCollisions.Next(out var triCollision)) { Draw.Ray(triCollision.Triangle->Center, triCollision.ContactNormal); } }

Property Documentation

◆ IgnoreCollision

Boolean Quantum.CollisionInfo3D.IgnoreCollision
getset

If the collision should be ignored by the physics engine.

◆ ContactNormal

FPVector3 Quantum.CollisionInfo3D.ContactNormal
get

The contact normal, from the Entity perspective.

In a mesh collision (IsMeshCollision true), this is the average normal of all triangle collisions in this mesh.

◆ Penetration

FP? Quantum.CollisionInfo3D.Penetration
get

The collision penetration in the ContactNormal direction.

◆ IsStatic

bool Quantum.CollisionInfo3D.IsStatic
get

If the Entity is touching a static collider. If so, Other has an EntityRef.None value and the static collider data can be accessed through StaticData.

if (info.IsStatic) { var otherStaticData = info.StaticData; } else { var otherEntity = info.Other; }

◆ IsMeshCollision

bool Quantum.CollisionInfo3D.IsMeshCollision
get

If the Entity is colliding with a static mesh. More data about the mesh collision, including individual triangle collisions, can be accessed in MeshTriangleCollisions.

if (info.IsMeshCollision) { while(info.MeshTriangleCollisions.Next(out var triCollision)) { Draw.Ray(triCollision.Triangle->Center, triCollision.ContactNormal); } }

◆ Entity

EntityRef? Quantum.CollisionInfo3D.Entity
get

The main entity involved in the collision.

The info is taken from the perspective of this entity, which has subscribed to the callback with Quantum.Physics3D.PhysicsEngine3D.SetCallbacks.

If both entities involved in a collision have subscribed to this collision type callback, it will be called twice, each time carrying information from the perspective of one of the entities.

◆ EntityShapeUserTag

UInt16? Quantum.CollisionInfo3D.EntityShapeUserTag
get

The Shape3D.UserTag of the entity's shape involved in the collision.

◆ Other

EntityRef? Quantum.CollisionInfo3D.Other
get

The other entity involved in the collision if the Entity is NOT colliding with a static (check IsStatic).

If the Entity is colliding with a static, Other has EntityRef.None value.

◆ OtherShapeUserTag

UInt16?? Quantum.CollisionInfo3D.OtherShapeUserTag
get

The Shape3D.UserTag of the other entity's shape involved in the collision. Returns default value if the this is a static collision.

◆ StaticData

StaticColliderData Quantum.CollisionInfo3D.StaticData
get

The StaticColliderData if the Entity is colliding with a static (check IsStatic).