1
0

PhysicsActor.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using log4net;
  28. using System;
  29. using System.Collections.Generic;
  30. using System.Reflection;
  31. using OpenSim.Framework;
  32. using OpenMetaverse;
  33. namespace OpenSim.Region.PhysicsModules.SharedBase
  34. {
  35. public delegate void PositionUpdate(Vector3 position);
  36. public delegate void VelocityUpdate(Vector3 velocity);
  37. public delegate void OrientationUpdate(Quaternion orientation);
  38. public enum ActorTypes : int
  39. {
  40. Unknown = 0,
  41. Agent = 1,
  42. Prim = 2,
  43. Ground = 3,
  44. Water = 4
  45. }
  46. public enum PIDHoverType
  47. {
  48. Ground,
  49. GroundAndWater,
  50. Water,
  51. Absolute
  52. }
  53. public struct CameraData
  54. {
  55. public Quaternion CameraRotation;
  56. public Vector3 CameraAtAxis;
  57. public bool MouseLook;
  58. public bool Valid;
  59. }
  60. public struct ContactPoint
  61. {
  62. public Vector3 Position;
  63. public Vector3 SurfaceNormal;
  64. public float PenetrationDepth;
  65. public float RelativeSpeed;
  66. public bool CharacterFeet;
  67. public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth)
  68. {
  69. Position = position;
  70. SurfaceNormal = surfaceNormal;
  71. PenetrationDepth = penetrationDepth;
  72. RelativeSpeed = 0f; // for now let this one be set explicity
  73. CharacterFeet = true; // keep other plugins work as before
  74. }
  75. public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth, bool feet)
  76. {
  77. Position = position;
  78. SurfaceNormal = surfaceNormal;
  79. PenetrationDepth = penetrationDepth;
  80. RelativeSpeed = 0f; // for now let this one be set explicity
  81. CharacterFeet = feet; // keep other plugins work as before
  82. }
  83. }
  84. public struct ContactData
  85. {
  86. public float mu;
  87. public float bounce;
  88. public bool softcolide;
  89. public ContactData(float _mu, float _bounce, bool _softcolide)
  90. {
  91. mu = _mu;
  92. bounce = _bounce;
  93. softcolide = _softcolide;
  94. }
  95. }
  96. /// <summary>
  97. /// Used to pass collision information to OnCollisionUpdate listeners.
  98. /// </summary>
  99. public class CollisionEventUpdate : EventArgs
  100. {
  101. /// <summary>
  102. /// Number of collision events in this update.
  103. /// </summary>
  104. public int Count { get { return m_objCollisionList.Count; } }
  105. public bool CollisionsOnPreviousFrame { get; private set; }
  106. public Dictionary<uint, ContactPoint> m_objCollisionList;
  107. public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList)
  108. {
  109. m_objCollisionList = objCollisionList;
  110. }
  111. public CollisionEventUpdate()
  112. {
  113. m_objCollisionList = new Dictionary<uint, ContactPoint>();
  114. }
  115. public void AddCollider(uint localID, ContactPoint contact)
  116. {
  117. if (!m_objCollisionList.ContainsKey(localID))
  118. {
  119. m_objCollisionList.Add(localID, contact);
  120. }
  121. else
  122. {
  123. float lastVel = m_objCollisionList[localID].RelativeSpeed;
  124. if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
  125. {
  126. if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed))
  127. contact.RelativeSpeed = lastVel;
  128. m_objCollisionList[localID] = contact;
  129. }
  130. else if(Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed))
  131. {
  132. ContactPoint tmp = m_objCollisionList[localID];
  133. tmp.RelativeSpeed = contact.RelativeSpeed;
  134. m_objCollisionList[localID] = tmp;
  135. }
  136. }
  137. }
  138. /// <summary>
  139. /// Clear added collision events.
  140. /// </summary>
  141. public void Clear()
  142. {
  143. m_objCollisionList.Clear();
  144. }
  145. }
  146. public abstract class PhysicsActor
  147. {
  148. // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  149. public delegate void RequestTerseUpdate();
  150. public delegate void CollisionUpdate(EventArgs e);
  151. public delegate void OutOfBounds(Vector3 pos);
  152. public delegate CameraData GetCameraData();
  153. // disable warning: public events
  154. #pragma warning disable 67
  155. public event PositionUpdate OnPositionUpdate;
  156. public event VelocityUpdate OnVelocityUpdate;
  157. public event OrientationUpdate OnOrientationUpdate;
  158. public event RequestTerseUpdate OnRequestTerseUpdate;
  159. public event GetCameraData OnPhysicsRequestingCameraData;
  160. /// <summary>
  161. /// Subscribers to this event must synchronously handle the dictionary of collisions received, since the event
  162. /// object is reused in subsequent physics frames.
  163. /// </summary>
  164. public event CollisionUpdate OnCollisionUpdate;
  165. public event OutOfBounds OnOutOfBounds;
  166. #pragma warning restore 67
  167. public CameraData TryGetCameraData()
  168. {
  169. GetCameraData handler = OnPhysicsRequestingCameraData;
  170. if (handler != null)
  171. {
  172. return handler();
  173. }
  174. return new CameraData { Valid = false };
  175. }
  176. public static PhysicsActor Null
  177. {
  178. get { return new NullPhysicsActor(); }
  179. }
  180. public virtual bool Building { get; set; }
  181. public virtual void getContactData(ref ContactData cdata)
  182. {
  183. cdata.mu = 0;
  184. cdata.bounce = 0;
  185. }
  186. public abstract bool Stopped { get; }
  187. public abstract Vector3 Size { get; set; }
  188. public virtual void setAvatarSize(Vector3 size, float feetOffset)
  189. {
  190. Size = size;
  191. }
  192. public virtual bool Phantom { get; set; }
  193. public virtual bool IsVolumeDtc
  194. {
  195. get { return false; }
  196. set { return; }
  197. }
  198. public virtual byte PhysicsShapeType { get; set; }
  199. public abstract PrimitiveBaseShape Shape { set; }
  200. uint m_baseLocalID;
  201. public virtual uint LocalID
  202. {
  203. set { m_baseLocalID = value; }
  204. get { return m_baseLocalID; }
  205. }
  206. public abstract bool Grabbed { set; }
  207. public abstract bool Selected { set; }
  208. /// <summary>
  209. /// Name of this actor.
  210. /// </summary>
  211. /// <remarks>
  212. /// XXX: Bizarrely, this cannot be "Terrain" or "Water" right now unless it really is simulating terrain or
  213. /// water. This is not a problem due to the formatting of names given by prims and avatars.
  214. /// </remarks>
  215. public string Name { get; set; }
  216. /// <summary>
  217. /// This is being used by ODE joint code.
  218. /// </summary>
  219. public string SOPName;
  220. public virtual void CrossingStart() { }
  221. public abstract void CrossingFailure();
  222. public abstract void link(PhysicsActor obj);
  223. public abstract void delink();
  224. public abstract void LockAngularMotion(byte axislocks);
  225. public virtual void RequestPhysicsterseUpdate()
  226. {
  227. // Make a temporary copy of the event to avoid possibility of
  228. // a race condition if the last subscriber unsubscribes
  229. // immediately after the null check and before the event is raised.
  230. RequestTerseUpdate handler = OnRequestTerseUpdate;
  231. if (handler != null)
  232. {
  233. handler();
  234. }
  235. }
  236. public virtual void RaiseOutOfBounds(Vector3 pos)
  237. {
  238. // Make a temporary copy of the event to avoid possibility of
  239. // a race condition if the last subscriber unsubscribes
  240. // immediately after the null check and before the event is raised.
  241. OutOfBounds handler = OnOutOfBounds;
  242. if (handler != null)
  243. {
  244. handler(pos);
  245. }
  246. }
  247. public virtual void SendCollisionUpdate(EventArgs e)
  248. {
  249. CollisionUpdate handler = OnCollisionUpdate;
  250. // m_log.DebugFormat("[PHYSICS ACTOR]: Sending collision for {0}", LocalID);
  251. if (handler != null)
  252. handler(e);
  253. }
  254. public virtual void SetMaterial (int material) { }
  255. public virtual float Density { get; set; }
  256. public virtual float GravModifier { get; set; }
  257. public virtual float Friction { get; set; }
  258. public virtual float Restitution { get; set; }
  259. /// <summary>
  260. /// Position of this actor.
  261. /// </summary>
  262. /// <remarks>
  263. /// Setting this directly moves the actor to a given position.
  264. /// Getting this retrieves the position calculated by physics scene updates, using factors such as velocity and
  265. /// collisions.
  266. /// </remarks>
  267. public abstract Vector3 Position { get; set; }
  268. public abstract float Mass { get; }
  269. public abstract Vector3 Force { get; set; }
  270. public abstract int VehicleType { get; set; }
  271. public abstract void VehicleFloatParam(int param, float value);
  272. public abstract void VehicleVectorParam(int param, Vector3 value);
  273. public abstract void VehicleRotationParam(int param, Quaternion rotation);
  274. public abstract void VehicleFlags(int param, bool remove);
  275. // This is an overridable version of SetVehicle() that works for all physics engines.
  276. // This is VERY inefficient. It behoves any physics engine to override this and
  277. // implement a more efficient setting of all the vehicle parameters.
  278. public virtual void SetVehicle(object pvdata)
  279. {
  280. VehicleData vdata = (VehicleData)pvdata;
  281. // vehicleActor.ProcessSetVehicle((VehicleData)vdata);
  282. this.VehicleType = (int)vdata.m_type;
  283. this.VehicleFlags(-1, false); // clears all flags
  284. this.VehicleFlags((int)vdata.m_flags, false);
  285. // Linear properties
  286. this.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_DIRECTION, vdata.m_linearMotorDirection);
  287. this.VehicleVectorParam((int)Vehicle.LINEAR_FRICTION_TIMESCALE, vdata.m_linearFrictionTimescale);
  288. this.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE, vdata.m_linearMotorDecayTimescale);
  289. this.VehicleFloatParam((int)Vehicle.LINEAR_MOTOR_TIMESCALE, vdata.m_linearMotorTimescale);
  290. this.VehicleVectorParam((int)Vehicle.LINEAR_MOTOR_OFFSET, vdata.m_linearMotorOffset);
  291. //Angular properties
  292. this.VehicleVectorParam((int)Vehicle.ANGULAR_MOTOR_DIRECTION, vdata.m_angularMotorDirection);
  293. this.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_TIMESCALE, vdata.m_angularMotorTimescale);
  294. this.VehicleFloatParam((int)Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE, vdata.m_angularMotorDecayTimescale);
  295. this.VehicleVectorParam((int)Vehicle.ANGULAR_FRICTION_TIMESCALE, vdata.m_angularFrictionTimescale);
  296. //Deflection properties
  297. this.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_EFFICIENCY, vdata.m_angularDeflectionEfficiency);
  298. this.VehicleFloatParam((int)Vehicle.ANGULAR_DEFLECTION_TIMESCALE, vdata.m_angularDeflectionTimescale);
  299. this.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_EFFICIENCY, vdata.m_linearDeflectionEfficiency);
  300. this.VehicleFloatParam((int)Vehicle.LINEAR_DEFLECTION_TIMESCALE, vdata.m_linearDeflectionTimescale);
  301. //Banking properties
  302. this.VehicleFloatParam((int)Vehicle.BANKING_EFFICIENCY, vdata.m_bankingEfficiency);
  303. this.VehicleFloatParam((int)Vehicle.BANKING_MIX, vdata.m_bankingMix);
  304. this.VehicleFloatParam((int)Vehicle.BANKING_TIMESCALE, vdata.m_bankingTimescale);
  305. //Hover and Buoyancy properties
  306. this.VehicleFloatParam((int)Vehicle.HOVER_HEIGHT, vdata.m_VhoverHeight);
  307. this.VehicleFloatParam((int)Vehicle.HOVER_EFFICIENCY, vdata.m_VhoverEfficiency);
  308. this.VehicleFloatParam((int)Vehicle.HOVER_TIMESCALE, vdata.m_VhoverTimescale);
  309. this.VehicleFloatParam((int)Vehicle.BUOYANCY, vdata.m_VehicleBuoyancy);
  310. //Attractor properties
  311. this.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, vdata.m_verticalAttractionEfficiency);
  312. this.VehicleFloatParam((int)Vehicle.VERTICAL_ATTRACTION_TIMESCALE, vdata.m_verticalAttractionTimescale);
  313. this.VehicleRotationParam((int)Vehicle.REFERENCE_FRAME, vdata.m_referenceFrame);
  314. }
  315. /// <summary>
  316. /// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
  317. /// </summary>
  318. public abstract void SetVolumeDetect(int param);
  319. public abstract Vector3 GeometricCenter { get; }
  320. public abstract Vector3 CenterOfMass { get; }
  321. public virtual float PhysicsCost
  322. {
  323. get
  324. {
  325. return 0.1f;
  326. }
  327. }
  328. public virtual float StreamCost
  329. {
  330. get
  331. {
  332. return 1.0f;
  333. }
  334. }
  335. /// <summary>
  336. /// The desired velocity of this actor.
  337. /// </summary>
  338. /// <remarks>
  339. /// Setting this provides a target velocity for physics scene updates.
  340. /// Getting this returns the last set target. Fetch Velocity to get the current velocity.
  341. /// </remarks>
  342. protected Vector3 m_targetVelocity;
  343. public virtual Vector3 TargetVelocity
  344. {
  345. get { return m_targetVelocity; }
  346. set {
  347. m_targetVelocity = value;
  348. Velocity = m_targetVelocity;
  349. }
  350. }
  351. public abstract Vector3 Velocity { get; set; }
  352. public virtual Vector3 rootVelocity { get { return Vector3.Zero; } }
  353. public abstract Vector3 Torque { get; set; }
  354. public abstract float CollisionScore { get; set;}
  355. public abstract Vector3 Acceleration { get; set; }
  356. public abstract Quaternion Orientation { get; set; }
  357. public abstract int PhysicsActorType { get; set; }
  358. public abstract bool IsPhysical { get; set; }
  359. public abstract bool Flying { get; set; }
  360. public abstract bool SetAlwaysRun { get; set; }
  361. public abstract bool ThrottleUpdates { get; set; }
  362. public abstract bool IsColliding { get; set; }
  363. public abstract bool CollidingGround { get; set; }
  364. public abstract bool CollidingObj { get; set; }
  365. public abstract bool FloatOnWater { set; }
  366. public abstract Vector3 RotationalVelocity { get; set; }
  367. public abstract bool Kinematic { get; set; }
  368. public abstract float Buoyancy { get; set; }
  369. // Used for MoveTo
  370. public abstract Vector3 PIDTarget { set; }
  371. public abstract bool PIDActive { get; set; }
  372. public abstract float PIDTau { set; }
  373. // Used for llSetHoverHeight and maybe vehicle height
  374. // Hover Height will override MoveTo target's Z
  375. public abstract bool PIDHoverActive {get; set;}
  376. public abstract float PIDHoverHeight { set;}
  377. public abstract PIDHoverType PIDHoverType { set;}
  378. public abstract float PIDHoverTau { set;}
  379. // For RotLookAt
  380. public abstract Quaternion APIDTarget { set;}
  381. public abstract bool APIDActive { set;}
  382. public abstract float APIDStrength { set;}
  383. public abstract float APIDDamping { set;}
  384. public abstract void AddForce(Vector3 force, bool pushforce);
  385. public abstract void AddAngularForce(Vector3 force, bool pushforce);
  386. public abstract void SetMomentum(Vector3 momentum);
  387. public abstract void SubscribeEvents(int ms);
  388. public abstract void UnSubscribeEvents();
  389. public abstract bool SubscribedEvents();
  390. public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
  391. public virtual void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) { }
  392. public virtual PhysicsInertiaData GetInertiaData()
  393. {
  394. PhysicsInertiaData data = new PhysicsInertiaData();
  395. data.TotalMass = this.Mass;
  396. data.CenterOfMass = CenterOfMass - Position;
  397. data.Inertia = Vector3.Zero;
  398. data.InertiaRotation = Vector4.Zero;
  399. return data;
  400. }
  401. public virtual void SetInertiaData(PhysicsInertiaData inertia)
  402. {
  403. }
  404. public virtual float SimulationSuspended { get; set; }
  405. // Warning in a parent part it returns itself, not null
  406. public virtual PhysicsActor ParentActor { get { return this; } }
  407. // Extendable interface for new, physics engine specific operations
  408. public virtual object Extension(string pFunct, params object[] pParams)
  409. {
  410. // A NOP of the physics engine does not implement this feature
  411. return null;
  412. }
  413. }
  414. public class NullPhysicsActor : PhysicsActor
  415. {
  416. private ActorTypes m_actorType = ActorTypes.Unknown;
  417. public override bool Stopped
  418. {
  419. get{ return true; }
  420. }
  421. public override Vector3 Position
  422. {
  423. get { return Vector3.Zero; }
  424. set { return; }
  425. }
  426. public override bool SetAlwaysRun
  427. {
  428. get { return false; }
  429. set { return; }
  430. }
  431. public override uint LocalID
  432. {
  433. get { return 0; }
  434. set { return; }
  435. }
  436. public override bool Grabbed
  437. {
  438. set { return; }
  439. }
  440. public override bool Selected
  441. {
  442. set { return; }
  443. }
  444. public override float Buoyancy
  445. {
  446. get { return 0f; }
  447. set { return; }
  448. }
  449. public override bool FloatOnWater
  450. {
  451. set { return; }
  452. }
  453. public override bool CollidingGround
  454. {
  455. get { return false; }
  456. set { return; }
  457. }
  458. public override bool CollidingObj
  459. {
  460. get { return false; }
  461. set { return; }
  462. }
  463. public override Vector3 Size
  464. {
  465. get { return Vector3.Zero; }
  466. set { return; }
  467. }
  468. public override float Mass
  469. {
  470. get { return 0f; }
  471. }
  472. public override Vector3 Force
  473. {
  474. get { return Vector3.Zero; }
  475. set { return; }
  476. }
  477. public override int VehicleType
  478. {
  479. get { return 0; }
  480. set { return; }
  481. }
  482. public override void VehicleFloatParam(int param, float value) {}
  483. public override void VehicleVectorParam(int param, Vector3 value) { }
  484. public override void VehicleRotationParam(int param, Quaternion rotation) { }
  485. public override void VehicleFlags(int param, bool remove) { }
  486. public override void SetVolumeDetect(int param) {}
  487. public override void SetMaterial(int material) {}
  488. public override Vector3 CenterOfMass { get { return Vector3.Zero; }}
  489. public override Vector3 GeometricCenter { get { return Vector3.Zero; }}
  490. public override PrimitiveBaseShape Shape { set { return; }}
  491. public override Vector3 Velocity
  492. {
  493. get { return Vector3.Zero; }
  494. set { return; }
  495. }
  496. public override Vector3 Torque
  497. {
  498. get { return Vector3.Zero; }
  499. set { return; }
  500. }
  501. public override float CollisionScore
  502. {
  503. get { return 0f; }
  504. set { }
  505. }
  506. public override void CrossingFailure() {}
  507. public override Quaternion Orientation
  508. {
  509. get { return Quaternion.Identity; }
  510. set { }
  511. }
  512. public override Vector3 Acceleration
  513. {
  514. get { return Vector3.Zero; }
  515. set { }
  516. }
  517. public override bool IsPhysical
  518. {
  519. get { return false; }
  520. set { return; }
  521. }
  522. public override bool Flying
  523. {
  524. get { return false; }
  525. set { return; }
  526. }
  527. public override bool ThrottleUpdates
  528. {
  529. get { return false; }
  530. set { return; }
  531. }
  532. public override bool IsColliding
  533. {
  534. get { return false; }
  535. set { return; }
  536. }
  537. public override int PhysicsActorType
  538. {
  539. get { return (int)m_actorType; }
  540. set {
  541. ActorTypes type = (ActorTypes)value;
  542. switch (type)
  543. {
  544. case ActorTypes.Ground:
  545. case ActorTypes.Water:
  546. m_actorType = type;
  547. break;
  548. default:
  549. m_actorType = ActorTypes.Unknown;
  550. break;
  551. }
  552. }
  553. }
  554. public override bool Kinematic
  555. {
  556. get { return true; }
  557. set { return; }
  558. }
  559. public override void link(PhysicsActor obj) { }
  560. public override void delink() { }
  561. public override void LockAngularMotion(byte axislocks) { }
  562. public override void AddForce(Vector3 force, bool pushforce) { }
  563. public override void AddAngularForce(Vector3 force, bool pushforce) { }
  564. public override Vector3 RotationalVelocity
  565. {
  566. get { return Vector3.Zero; }
  567. set { return; }
  568. }
  569. public override Vector3 PIDTarget { set { return; } }
  570. public override bool PIDActive
  571. {
  572. get { return false; }
  573. set { return; }
  574. }
  575. public override float PIDTau { set { return; } }
  576. public override float PIDHoverHeight { set { return; } }
  577. public override bool PIDHoverActive {get {return false;} set { return; } }
  578. public override PIDHoverType PIDHoverType { set { return; } }
  579. public override float PIDHoverTau { set { return; } }
  580. public override Quaternion APIDTarget { set { return; } }
  581. public override bool APIDActive { set { return; } }
  582. public override float APIDStrength { set { return; } }
  583. public override float APIDDamping { set { return; } }
  584. public override void SetMomentum(Vector3 momentum) { }
  585. public override void SubscribeEvents(int ms) { }
  586. public override void UnSubscribeEvents() { }
  587. public override bool SubscribedEvents() { return false; }
  588. }
  589. }