Capsule.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. /// <summary>
  7. /// Represents a capsule with a line segment and a radius.
  8. /// </summary>
  9. [StructLayout(LayoutKind.Sequential), SerializeObject]
  10. public struct Capsule // Note: Must match C++ struct Capsule
  11. {
  12. [SerializeField]
  13. private LineSegment segment;
  14. [SerializeField]
  15. private float radius;
  16. /// <summary>
  17. /// Radius that defines the distance of the capsule from its line segment.
  18. /// </summary>
  19. public float Radius
  20. {
  21. get { return radius; }
  22. set { radius = value; }
  23. }
  24. /// <summary>
  25. /// Line segment along which the capsule lies. All capsule points are at equal distance from this segment.
  26. /// </summary>
  27. public LineSegment Segment
  28. {
  29. get { return segment; }
  30. set { segment = value; }
  31. }
  32. /// <summary>
  33. /// Creates a new capsule object.
  34. /// </summary>
  35. /// <param name="center">Line segment along which the capsule lies.</param>
  36. /// <param name="radius">Radius that defines the distance of the capsule from its line segment.</param>
  37. public Capsule(LineSegment segment, float radius)
  38. {
  39. this.segment = segment;
  40. this.radius = radius;
  41. }
  42. };
  43. }