// public override Vector3 Scaling // { // get => cachedScaling; // set // { // base.Scaling = value; // foreach (var colliderShape in colliderShapes) // { // colliderShape.Scaling = cachedScaling; // } // } // } internal override void CreateAndAddCollidableDescription( BepuPhysicsComponent physicsComponent, BepuSimulation xenkoSimulation, out TypedIndex shapeTypeIndex, out CollidableDescription collidableDescription) { //throw new System.NotImplementedException(); shapeTypeIndex = default; collidableDescription = default; }
internal override void CreateAndAddCollidableDescription( BepuPhysicsComponent physicsComponent, BepuSimulation xenkoSimulation, out TypedIndex shapeTypeIndex, out CollidableDescription collidableDescription) { CreateAndAddCollidableDescription <Sphere>( physicsComponent, xenkoSimulation, out shapeTypeIndex, out collidableDescription); }
public bool IsIgnoringCollisionWith(BepuPhysicsComponent other) { if (ignoreCollisionBuffer != null) { return(ignoreCollisionBuffer.TryGetValue(other, out var state) && state == CollisionState.Ignore); } else if (other.ignoreCollisionBuffer != null) { return(other.IsIgnoringCollisionWith(this)); } return(false); }
public void Initialize(BepuPhysicsComponent colliderA, BepuPhysicsComponent colliderB) { ColliderA = colliderA; ColliderB = colliderB; NewContactChannel = ChannelsPool.Count == 0 ? new Channel <BepuContactPoint> { Preference = ChannelPreference.PreferSender } : ChannelsPool.Dequeue(); ContactUpdateChannel = ChannelsPool.Count == 0 ? new Channel <BepuContactPoint> { Preference = ChannelPreference.PreferSender } : ChannelsPool.Dequeue(); ContactEndedChannel = ChannelsPool.Count == 0 ? new Channel <BepuContactPoint> { Preference = ChannelPreference.PreferSender } : ChannelsPool.Dequeue(); }
public void IgnoreCollisionWith(BepuPhysicsComponent other, CollisionState state) { //var otherNative = other.NativeCollisionObject; //if (!NativeCollidableReference.IsSet || !other.NativeCollidableReference.IsSet) //{ // if (ignoreCollisionBuffer != null || other.ignoreCollisionBuffer == null) // { // if (ignoreCollisionBuffer == null) // ignoreCollisionBuffer = new Dictionary<BepuPhysicsComponent, CollisionState>(); // if (ignoreCollisionBuffer.ContainsKey(other)) // ignoreCollisionBuffer[other] = state; // else // ignoreCollisionBuffer.Add(other, state); // } // else // { // other.IgnoreCollisionWith(this, state); // } // return; //} //switch (state) //{ // // Note that we're calling 'SetIgnoreCollisionCheck' on both objects as bullet doesn't // // do it itself ; One of the object in the pair will report that it doesn't ignore // // collision with the other even though you set the other as ignoring the former. // case CollisionState.Ignore: // { // // Bullet uses an array per collision object to store all of the objects to ignore, // // when calling this method it adds the referenced object without checking for duplicates, // // so if a user where to call 'Ignore' of this function on this object n-times he'll have to call it // // that same amount of time to re-detect them instead of just once. // // We're calling false here to remove a previous ignore if there was any and re-ignoring // // to force it to have only a single instance. // otherNative.SetIgnoreCollisionCheck(NativeCollisionObject, false); // NativeCollisionObject.SetIgnoreCollisionCheck(otherNative, false); // otherNative.SetIgnoreCollisionCheck(NativeCollisionObject, true); // NativeCollisionObject.SetIgnoreCollisionCheck(otherNative, true); // break; // } // case CollisionState.Detect: // { // otherNative.SetIgnoreCollisionCheck(NativeCollisionObject, false); // NativeCollisionObject.SetIgnoreCollisionCheck(otherNative, false); // break; // } //} }
public ColliderShapeCollection(BepuPhysicsComponent componentParam) { component = componentParam; }
internal bool InternalEquals(BepuPhysicsComponent a, BepuPhysicsComponent b) { return((ColliderA == a && ColliderB == b) || (ColliderB == a && ColliderA == b)); }