PhysicsActor.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * Copyright (c) OpenSim project, http://sim.opensecondlife.org/
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. * * Redistributions of source code must retain the above copyright
  7. * notice, this list of conditions and the following disclaimer.
  8. * * Redistributions in binary form must reproduce the above copyright
  9. * notice, this list of conditions and the following disclaimer in the
  10. * documentation and/or other materials provided with the distribution.
  11. * * Neither the name of the <organization> nor the
  12. * names of its contributors may be used to endorse or promote products
  13. * derived from this software without specific prior written permission.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
  16. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  19. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Text;
  30. namespace OpenSim.Physics.Manager
  31. {
  32. public abstract class PhysicsActor
  33. {
  34. public static PhysicsActor Null
  35. {
  36. get
  37. {
  38. return new NullPhysicsActor();
  39. }
  40. }
  41. public abstract PhysicsVector Position
  42. {
  43. get;
  44. set;
  45. }
  46. public abstract PhysicsVector Velocity
  47. {
  48. get;
  49. set;
  50. }
  51. public abstract PhysicsVector Acceleration
  52. {
  53. get;
  54. }
  55. public abstract Axiom.MathLib.Quaternion Orientation
  56. {
  57. get;
  58. set;
  59. }
  60. public abstract bool Flying
  61. {
  62. get;
  63. set;
  64. }
  65. public abstract bool Kinematic
  66. {
  67. get;
  68. set;
  69. }
  70. public abstract void AddForce(PhysicsVector force);
  71. public abstract void SetMomentum(PhysicsVector momentum);
  72. }
  73. public class NullPhysicsActor : PhysicsActor
  74. {
  75. public override PhysicsVector Position
  76. {
  77. get
  78. {
  79. return PhysicsVector.Zero;
  80. }
  81. set
  82. {
  83. return;
  84. }
  85. }
  86. public override PhysicsVector Velocity
  87. {
  88. get
  89. {
  90. return PhysicsVector.Zero;
  91. }
  92. set
  93. {
  94. return;
  95. }
  96. }
  97. public override Axiom.MathLib.Quaternion Orientation
  98. {
  99. get
  100. {
  101. return Axiom.MathLib.Quaternion.Identity;
  102. }
  103. set
  104. {
  105. }
  106. }
  107. public override PhysicsVector Acceleration
  108. {
  109. get { return PhysicsVector.Zero; }
  110. }
  111. public override bool Flying
  112. {
  113. get
  114. {
  115. return false;
  116. }
  117. set
  118. {
  119. return;
  120. }
  121. }
  122. public override bool Kinematic
  123. {
  124. get
  125. {
  126. return true;
  127. }
  128. set
  129. {
  130. return;
  131. }
  132. }
  133. public override void AddForce(PhysicsVector force)
  134. {
  135. return;
  136. }
  137. public override void SetMomentum(PhysicsVector momentum)
  138. {
  139. return;
  140. }
  141. }
  142. }