/
EugenyCh7
/
Puppet2D.Net
Обзор
Документация
Войти
/
EugenyCh7
/
Puppet2D.Net
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Puppet2D.Engine/Geometry/Capsule.cs
33 строки
852 B
Eugeny Chekmarev
Puppet2D.Engine.Geometry rotation fix
25 авг 2025, 13:22
25 авг 2025, 13:22
73b16ee
Код
Авторство
О чём код?
using Puppet2D.System; namespace Puppet2D.Engine.Geometry { /// <summary> /// A solid capsule can be viewed as two semicircles connected by a rectangle. /// </summary> public struct Capsule { public float Angle; public float Radius; public Vector2 Point1; public Vector2 Point2; public Vector2 Center => (Point1 + Point2) * 0.5f; internal Capsule(B2.Capsule capsule) { Point1 = capsule.center1; Point2 = capsule.center2; Radius = capsule.radius; } internal B2.Capsule CastToCapsule() { return new B2.Capsule { center1 = Point1.Rotate(Angle, Center), center2 = Point2.Rotate(Angle, Center), radius = Radius }; } } }