/
EugenyCh7
/
Puppet2D.Net
Обзор
Документация
Войти
/
EugenyCh7
/
Puppet2D.Net
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Puppet2D.Engine/Common/Filter.cs
56 строк
2 KB
EugenyCh7
- Puppet2D.Engine.Collision
24 авг 2025, 18:34
24 авг 2025, 18:34
d1742be
Код
Авторство
О чём код?
namespace Puppet2D.Engine.Common { /// <summary> /// This is used to filter collision on shapes. /// It affects shape-vs-shape collision and shape-versus-query collision(such as b2World_CastRay). /// </summary> public struct Filter { /// <summary> /// The collision category bits. /// Normally you would just set one bit. The category bits should represent your application object types. /// </summary> public ulong CategoryBits { get; set; } /// <summary> /// Collision groups allow a certain group of objects to never collide (negative) or always collide (positive). /// A group index of zero has no effect.Non-zero group filtering always wins against the mask bits. /// For example, you may want ragdolls to collide with other ragdolls but you don't want ragdoll self-collision. /// In this case you would give each ragdoll a unique negative group index and apply that group index to all shapes on the ragdoll. /// </summary> public int GroupIndex { get; set; } /// <summary> /// The collision mask bits. /// This states the categories that this shape would accept for collision. /// For example, you may want your player to only collide with static objects and other players. /// </summary> public ulong MaskBits { get; set; } public static Filter Default { get { B2.Filter filter = B2.DefaultFilter(); return new Filter(filter); } } internal Filter(B2.Filter filter) { CategoryBits = filter.categoryBits; MaskBits = filter.maskBits; GroupIndex = filter.groupIndex; } internal B2.Filter Cast() { return new B2.Filter { categoryBits = CategoryBits, maskBits = MaskBits, groupIndex = GroupIndex }; } } }