public void SetBit(uint bit) { if (bit == (uint)ColliderShapeType.CONVEX_SHAPE || bit == (uint)ColliderShapeType.BOUND_RECT_SHAPE || bit == (uint)ColliderShapeType.MESH_SHAPE) { _shapeType = (ColliderShapeType)bit; } else if (bit == (uint)PlaneOrientation.HORIZONTAL || bit == (uint)PlaneOrientation.VERTICAL || bit == (uint)PlaneOrientation.OBLIQUE || bit == (uint)PlaneOrientation.FRAGMENT) { _orientation = (PlaneOrientation)bit; } PropBits = (uint)_shapeType | (uint)_orientation; }
private void _LinkColliderInfo(ColliderShapeType type, List <ViveSR_StaticColliderInfo> srcList, List <ViveSR_StaticColliderInfo>[] dstListArray) { for (int listID = 0; listID < dstListArray.Length; ++listID) { List <ViveSR_StaticColliderInfo> dstList = dstListArray[listID]; for (int i = 0; i < dstList.Count; ++i) { if (dstList[i] != null && srcList[i] != null) { dstList[i].SetCorrespondingColliderOfType(type, srcList[i]); } } } }
public void SetCorrespondingColliderOfType(ColliderShapeType type, ViveSR_StaticColliderInfo info) { if (type == ColliderShapeType.CONVEX_SHAPE) { _corresConvexCld = info; } else if (type == ColliderShapeType.BOUND_RECT_SHAPE) { _corresBoundingRectCld = info; } else if (type == ColliderShapeType.MESH_SHAPE) { _corresMeshCld = info; } }
void AddColliderInfo(Entity entity, EntityManager dstManager, ColliderShapeType shape) { switch (shape) { case ColliderShapeType.Circle: AddCircleCollider(entity, dstManager); break; case ColliderShapeType.Polygon: AddPolygonCollider(entity, dstManager); break; case ColliderShapeType.Cone: break; } }
public ViveSR_StaticColliderInfo GetCorrespondingColliderOfType(ColliderShapeType type) { if (type == ColliderShapeType.CONVEX_SHAPE) { return(_corresConvexCld); } else if (type == ColliderShapeType.BOUND_RECT_SHAPE) { return(_corresBoundingRectCld); } else if (type == ColliderShapeType.MESH_SHAPE) { return(_corresMeshCld); } else { return(null); } }
// get colliders within customized height range public ViveSR_StaticColliderInfo[] GetColliderByHeightRange(ColliderShapeType shapeType, float lowestHeight, float highestHeight) { _tempList.Clear(); if (lowestHeight <= highestHeight) { for (int i = 0; i < allColliders.Count; i++) { ViveSR_StaticColliderInfo info = allColliders[i]; if (info.CheckHasAllBit((uint)shapeType)) { Vector3 center = info.GetComponent <MeshRenderer>().bounds.center; if (center.y >= lowestHeight && center.y <= highestHeight) { _tempList.Add(info); } } } } return(_tempList.ToArray()); }