30 using System.Collections.Generic;
31 using System.Reflection;
32 using OpenSim.Framework;
35 namespace OpenSim.
Region.PhysicsModules.SharedBase
66 public ContactPoint(Vector3 position, Vector3 surfaceNormal,
float penetrationDepth)
69 SurfaceNormal = surfaceNormal;
70 PenetrationDepth = penetrationDepth;
75 public ContactPoint(Vector3 position, Vector3 surfaceNormal,
float penetrationDepth,
bool feet)
78 SurfaceNormal = surfaceNormal;
79 PenetrationDepth = penetrationDepth;
91 public ContactData(
float _mu,
float _bounce,
bool _softcolide)
95 softcolide = _softcolide;
106 public int Count {
get {
return m_objCollisionList.Count; } }
108 public bool CollisionsOnPreviousFrame {
get;
private set; }
114 m_objCollisionList = objCollisionList;
119 m_objCollisionList =
new Dictionary<uint, ContactPoint>();
124 if (!m_objCollisionList.ContainsKey(localID))
126 m_objCollisionList.Add(localID, contact);
130 if (m_objCollisionList[localID].PenetrationDepth < contact.
PenetrationDepth)
131 m_objCollisionList[localID] = contact;
140 m_objCollisionList.Clear();
148 public delegate
void RequestTerseUpdate();
149 public delegate
void CollisionUpdate(EventArgs e);
150 public delegate
void OutOfBounds(Vector3 pos);
153 #pragma warning disable 67
166 #pragma warning restore 67
173 public virtual bool Building {
get; set; }
181 public abstract bool Stopped {
get; }
183 public abstract Vector3
Size {
get; set; }
190 public virtual bool Phantom {
get; set; }
192 public virtual bool IsVolumeDtc
194 get {
return false; }
198 public virtual byte PhysicsShapeType {
get; set; }
203 public virtual uint LocalID
205 set { m_baseLocalID = value; }
206 get {
return m_baseLocalID; }
209 public abstract bool Grabbed { set; }
211 public abstract bool Selected { set; }
220 public string Name {
get; set; }
227 public abstract void CrossingFailure();
231 public abstract void delink();
233 public abstract void LockAngularMotion(byte axislocks);
240 RequestTerseUpdate handler = OnRequestTerseUpdate;
253 OutOfBounds handler = OnOutOfBounds;
263 CollisionUpdate handler = OnCollisionUpdate;
272 public virtual float Density {
get; set; }
273 public virtual float GravModifier {
get; set; }
274 public virtual float Friction {
get; set; }
275 public virtual float Restitution {
get; set; }
287 public abstract float Mass {
get; }
288 public abstract Vector3 Force {
get; set; }
290 public abstract int VehicleType {
get; set; }
291 public abstract void VehicleFloatParam(
int param,
float value);
292 public abstract void VehicleVectorParam(
int param, Vector3 value);
293 public abstract void VehicleRotationParam(
int param, Quaternion
rotation);
294 public abstract void VehicleFlags(
int param,
bool remove);
304 this.VehicleType = (int)vdata.
m_type;
305 this.VehicleFlags(-1,
false);
306 this.VehicleFlags((int)vdata.
m_flags,
false);
349 public abstract void SetVolumeDetect(
int param);
351 public abstract Vector3 GeometricCenter {
get; }
352 public abstract Vector3 CenterOfMass {
get; }
354 public virtual float PhysicsCost
362 public virtual float StreamCost
378 public virtual Vector3 TargetVelocity
380 get {
return m_targetVelocity; }
382 m_targetVelocity = value;
389 public abstract Vector3 Torque {
get; set; }
390 public abstract float CollisionScore {
get; set;}
392 public abstract Quaternion Orientation {
get; set; }
393 public abstract int PhysicsActorType {
get; set; }
394 public abstract bool IsPhysical {
get; set; }
395 public abstract bool Flying {
get; set; }
397 public abstract bool ThrottleUpdates {
get; set; }
398 public abstract bool IsColliding {
get; set; }
399 public abstract bool CollidingGround {
get; set; }
400 public abstract bool CollidingObj {
get; set; }
401 public abstract bool FloatOnWater { set; }
402 public abstract Vector3 RotationalVelocity {
get; set; }
403 public abstract bool Kinematic {
get; set; }
404 public abstract float Buoyancy {
get; set; }
407 public abstract Vector3 PIDTarget { set; }
408 public abstract bool PIDActive {
get; set; }
409 public abstract float PIDTau { set; }
413 public abstract bool PIDHoverActive {
get; set;}
414 public abstract float PIDHoverHeight { set;}
416 public abstract float PIDHoverTau { set;}
419 public abstract Quaternion APIDTarget { set;}
420 public abstract bool APIDActive { set;}
421 public abstract float APIDStrength { set;}
422 public abstract float APIDDamping { set;}
424 public abstract void AddForce(Vector3 force,
bool pushforce);
425 public abstract void AddAngularForce(Vector3 force,
bool pushforce);
426 public abstract void SetMomentum(Vector3 momentum);
427 public abstract void SubscribeEvents(
int ms);
428 public abstract void UnSubscribeEvents();
429 public abstract bool SubscribedEvents();
438 public virtual object Extension(
string pFunct, params
object[] pParams)
447 private ActorTypes m_actorType = ActorTypes.Unknown;
449 public override bool Stopped
456 get {
return Vector3.Zero; }
462 get {
return false; }
466 public override uint LocalID
472 public override bool Grabbed
477 public override bool Selected
482 public override float Buoyancy
488 public override bool FloatOnWater
493 public override bool CollidingGround
495 get {
return false; }
499 public override bool CollidingObj
501 get {
return false; }
505 public override Vector3
Size
507 get {
return Vector3.Zero; }
511 public override float Mass
516 public override Vector3 Force
518 get {
return Vector3.Zero; }
522 public override int VehicleType
534 public override Vector3 CenterOfMass {
get {
return Vector3.Zero; }}
536 public override Vector3 GeometricCenter {
get {
return Vector3.Zero; }}
542 get {
return Vector3.Zero; }
546 public override Vector3 Torque
548 get {
return Vector3.Zero; }
552 public override float CollisionScore
560 public override Quaternion Orientation
562 get {
return Quaternion.Identity; }
568 get {
return Vector3.Zero; }
572 public override bool IsPhysical
574 get {
return false; }
578 public override bool Flying
580 get {
return false; }
584 public override bool ThrottleUpdates
586 get {
return false; }
590 public override bool IsColliding
592 get {
return false; }
596 public override int PhysicsActorType
598 get {
return (
int)m_actorType; }
603 case ActorTypes.Ground:
604 case ActorTypes.Water:
608 m_actorType = ActorTypes.Unknown;
614 public override bool Kinematic
623 public override void AddForce(Vector3 force,
bool pushforce) { }
626 public override Vector3 RotationalVelocity
628 get {
return Vector3.Zero; }
632 public override Vector3 PIDTarget { set {
return; } }
634 public override bool PIDActive
636 get {
return false; }
640 public override float PIDTau { set {
return; } }
642 public override float PIDHoverHeight { set {
return; } }
643 public override bool PIDHoverActive {
get {
return false;} set {
return; } }
645 public override float PIDHoverTau { set {
return; } }
647 public override Quaternion APIDTarget { set {
return; } }
648 public override bool APIDActive { set {
return; } }
649 public override float APIDStrength { set {
return; } }
650 public override float APIDDamping { set {
return; } }
float m_linearMotorTimescale
OutOfBounds OnOutOfBounds
override void link(PhysicsActor obj)
float m_linearDeflectionEfficiency
float m_linearDeflectionTimescale
override void VehicleRotationParam(int param, Quaternion rotation)
virtual void setAvatarSize(Vector3 size, float feetOffset)
virtual object Extension(string pFunct, params object[] pParams)
override void VehicleVectorParam(int param, Vector3 value)
Vector3 m_targetVelocity
The desired velocity of this actor.
void Clear()
Clear added collision events.
float m_verticalAttractionTimescale
float m_bankingEfficiency
VelocityUpdate OnVelocityUpdate
float m_verticalAttractionEfficiency
float m_angularMotorDecayTimescale
Vector3 m_angularFrictionTimescale
override void SetMomentum(Vector3 momentum)
delegate void SetAlwaysRun(IClientAPI remoteClient, bool SetAlwaysRun)
float m_angularMotorTimescale
Vector3 m_linearMotorDirection
virtual void SendCollisionUpdate(EventArgs e)
override void UnSubscribeEvents()
override bool SubscribedEvents()
Used to pass collision information to OnCollisionUpdate listeners.
override void AddForce(Vector3 force, bool pushforce)
virtual void getContactData(ref ContactData cdata)
Vector3 m_linearMotorOffset
virtual void RequestPhysicsterseUpdate()
OrientationUpdate OnOrientationUpdate
delegate void PositionUpdate(Vector3 position)
override void SetVolumeDetect(int param)
Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more ...
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
string SOPName
This is being used by ODE joint code.
override void AddAngularForce(Vector3 force, bool pushforce)
virtual void RaiseOutOfBounds(Vector3 pos)
Dictionary< uint, ContactPoint > m_objCollisionList
override void SubscribeEvents(int ms)
override void SetMaterial(int material)
Quaternion m_referenceFrame
float m_angularDeflectionTimescale
Vector3 m_linearFrictionTimescale
Vector3 m_angularMotorDirection
virtual void SetMaterial(int material)
CollisionEventUpdate(Dictionary< uint, ContactPoint > objCollisionList)
override void CrossingFailure()
virtual void SetVehicle(object pvdata)
float m_linearMotorDecayTimescale
void AddCollider(uint localID, ContactPoint contact)
PositionUpdate OnPositionUpdate
virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
override void VehicleFlags(int param, bool remove)
delegate void OrientationUpdate(Quaternion orientation)
override void VehicleFloatParam(int param, float value)
override void LockAngularMotion(byte axislocks)
CollisionUpdate OnCollisionUpdate
Subscribers to this event must synchronously handle the dictionary of collisions received, since the event object is reused in subsequent physics frames.
delegate void VelocityUpdate(Vector3 velocity)
float m_angularDeflectionEfficiency
RequestTerseUpdate OnRequestTerseUpdate