2
0

Capsule.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System.Runtime.InteropServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Math
  7. * @{
  8. */
  9. /// <summary>
  10. /// Represents a capsule with a line segment and a radius.
  11. /// </summary>
  12. [StructLayout(LayoutKind.Sequential), SerializeObject]
  13. public struct Capsule // Note: Must match C++ struct Capsule
  14. {
  15. [SerializeField]
  16. private LineSegment segment;
  17. [SerializeField]
  18. private float radius;
  19. /// <summary>
  20. /// Radius that defines the distance of the capsule from its line segment.
  21. /// </summary>
  22. public float Radius
  23. {
  24. get { return radius; }
  25. set { radius = value; }
  26. }
  27. /// <summary>
  28. /// Line segment along which the capsule lies. All capsule points are at equal distance from this segment.
  29. /// </summary>
  30. public LineSegment Segment
  31. {
  32. get { return segment; }
  33. set { segment = value; }
  34. }
  35. /// <summary>
  36. /// Creates a new capsule object.
  37. /// </summary>
  38. /// <param name="segment">Line segment along which the capsule lies.</param>
  39. /// <param name="radius">Radius that defines the distance of the capsule from its line segment.</param>
  40. public Capsule(LineSegment segment, float radius)
  41. {
  42. this.segment = segment;
  43. this.radius = radius;
  44. }
  45. };
  46. /** @} */
  47. }