Ejemplo n.º 1
0
        public static PhysX.RigidActor CreateProperInitialActor(PhysicsShape meshedShape, PhysxScene scene, OpenMetaverse.Vector3 pos,
                                                                OpenMetaverse.Quaternion rotation, PhysicsScene.AddPrimShapeFlags flags, out bool kinematicStatic,
                                                                Material material)
        {
            bool isPhysical = (flags & PhysicsScene.AddPrimShapeFlags.Physical) != 0;

            kinematicStatic = false;

            PhysX.RigidActor actor;
            if (isPhysical)
            {
                actor = PhysxActorFactory.CreateRigidDynamic(scene, meshedShape, pos, rotation, isPhysical, kinematicStatic, material);
            }
            else
            {
                if ((flags & PhysicsScene.AddPrimShapeFlags.FromSceneStartup) != 0)
                {
                    actor = PhysxActorFactory.CreateRigidStatic(scene, meshedShape, pos, rotation, material);
                }
                else
                {
                    kinematicStatic = true;
                    actor           = PhysxActorFactory.CreateRigidDynamic(scene, meshedShape, pos, rotation, isPhysical, kinematicStatic, material);
                }
            }

            return(actor);
        }
Ejemplo n.º 2
0
        public override void GatherTerseUpdate(out OpenMetaverse.Vector3 position, out OpenMetaverse.Quaternion rotation, out OpenMetaverse.Vector3 velocity, out OpenMetaverse.Vector3 acceleration, out OpenMetaverse.Vector3 angularVelocity)
        {
            lock (_terseConsistencyLock)
            {
                position = _position;
                rotation = _rotation;
                velocity = _velocity;

                //if this is a child prim, or it is not physical, report angular velocity
                //as whatever our target is (targetomega)
                //this is necessary because changing this physical and back again will
                //change the angular velocity and currently TargetOmega is implemented
                //as an overwrite to angular velocity which is wrong.
                if (IsChild || !_isPhysical)
                {
                    angularVelocity = _properties.AngularVelocityTarget;
                }
                else if (_useAngularVelocity)
                {
                    angularVelocity = _angularVelocity;
                }
                else
                {
                    angularVelocity = OpenMetaverse.Vector3.Zero;
                }

                acceleration = _acceleration;
            }
        }
Ejemplo n.º 3
0
 public void StaticUpdated(uint actorID, OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion orientation)
 {
     // Update the result variables
     m_resultStaticID        = actorID;
     m_resultPosition        = position;
     m_resultOrientation     = orientation;
     m_staticResultsReceived = true;
 }
Ejemplo n.º 4
0
 public static LSL_Rotation EHArgUnwrapRotation(object x)
 {
     if (x is OpenMetaverse.Quaternion)
     {
         OpenMetaverse.Quaternion q = (OpenMetaverse.Quaternion)x;
         return(new LSL_Rotation(q.X, q.Y, q.Z, q.W));
     }
     return((LSL_Rotation)x);
 }
Ejemplo n.º 5
0
 public CreateCharacterCmd(float height, float radius, OpenMetaverse.Vector3 pos,
                           OpenMetaverse.Quaternion rot, bool flying, OpenMetaverse.Vector3 initialVelocity)
 {
     _height          = height;
     _radius          = radius;
     _position        = pos;
     _rotation        = rot;
     _flying          = flying;
     _initialVelocity = initialVelocity;
 }
Ejemplo n.º 6
0
        public override void LinkToNewParent(PhysicsActor obj, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            lock (_terseConsistencyLock)
            {
                _position = localPos;
                _rotation = localRot;
            }

            _parentPrim = (BasicPrim)obj;
        }
Ejemplo n.º 7
0
 public override void UpdateOffsetPosition(OpenMetaverse.Vector3 newOffset, OpenMetaverse.Quaternion rotOffset)
 {
     //Offset updates are only handled for child prims. Upstream a non child move is
     //handled by setting our position directly
     if (IsChild)
     {
         _position = newOffset;
         _rotation = rotOffset;
     }
 }
Ejemplo n.º 8
0
 public CreateCharacterCmd(float height, float radius, OpenMetaverse.Vector3 pos,
     OpenMetaverse.Quaternion rot, bool flying, OpenMetaverse.Vector3 initialVelocity)
 {
     _height = height;
     _radius = radius;
     _position = pos;
     _rotation = rot;
     _flying = flying;
     _initialVelocity = initialVelocity;
 }
Ejemplo n.º 9
0
        public override void DelinkFromParent(OpenMetaverse.Vector3 newWorldPosition, OpenMetaverse.Quaternion newWorldRotation)
        {
            lock (_terseConsistencyLock)
            {
                _position = newWorldPosition;
                _rotation = newWorldRotation;
            }

            _parentPrim = null;
        }
Ejemplo n.º 10
0
        public override void SetRotLookAtTarget(OpenMetaverse.Quaternion target, float strength, float damping)
        {
            lock (_properties)
            {
                _properties.RotLookTarget   = target;
                _properties.RotLookStrength = OpenMetaverse.Utils.Clamp(strength, 0.1f, 1.0f);
                _properties.RotLookDamping  = OpenMetaverse.Utils.Clamp(damping, 0.1f, 100.0f);
            }

            _scene.QueueCommand(new Commands.WakeUpCmd(this));
        }
Ejemplo n.º 11
0
        public static String AvatarMoved(string uuid, OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector3 velocity)
        {
            Dictionary <string, object> msg = new Dictionary <string, object>();

            msg ["type"]     = "moveAvatar";
            msg ["uuid"]     = uuid;
            msg ["position"] = position;
            msg ["rotation"] = rotation;
            msg ["velocity"] = velocity;
            return(MGMJson.Encode(msg));
        }
Ejemplo n.º 12
0
 public void DynamicUpdated(uint actorID, OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion orientation,
                            OpenMetaverse.Vector3 linearVelocity, OpenMetaverse.Vector3 angularVelocity)
 {
     Console.WriteLine("Received dynamic results!");
     // Update the result variables
     m_resultDynamicID        = actorID;
     m_resultPosition         = position;
     m_resultOrientation      = orientation;
     m_resultLinearVelocity   = linearVelocity;
     m_resultAngularVelocity  = angularVelocity;
     m_dynamicResultsReceived = true;
 }
Ejemplo n.º 13
0
        public ChangeChildPrimOffsetCmd(PhysxPrim parent, PhysxPrim child, OpenMetaverse.Vector3 newOffset,
            OpenMetaverse.Quaternion rotOffset)
        {
            Util.ThrowIfNull(parent, "parent");
            Util.ThrowIfNull(child, "child");

            _parent = parent;
            _child = child;
            _newOffset = newOffset;
            _rotOffset = rotOffset;
            _affectedPrims = new List<PhysxPrim> { parent, child };
        }
        public UnlinkFromParentCmd(PhysxPrim child, PhysxPrim parent, OpenMetaverse.Vector3 newWorldPosition,
                                   OpenMetaverse.Quaternion newWorldRotation)
        {
            Util.ThrowIfNull(parent, "parent");
            Util.ThrowIfNull(child, "child");

            _child            = child;
            _parent           = parent;
            _newWorldPosition = newWorldPosition;
            _newWorldRotation = newWorldRotation;

            _targetPrims = new PhysxPrim[] { child, parent };
        }
Ejemplo n.º 15
0
        public UnlinkFromParentCmd(PhysxPrim child, PhysxPrim parent, OpenMetaverse.Vector3 newWorldPosition, 
            OpenMetaverse.Quaternion newWorldRotation)
        {
            Util.ThrowIfNull(parent, "parent");
            Util.ThrowIfNull(child, "child");

            _child = child;
            _parent = parent;
            _newWorldPosition = newWorldPosition;
            _newWorldRotation = newWorldRotation;

            _targetPrims = new PhysxPrim[] { child, parent };
        }
Ejemplo n.º 16
0
        public ChangeChildPrimOffsetCmd(PhysxPrim parent, PhysxPrim child, OpenMetaverse.Vector3 newOffset,
                                        OpenMetaverse.Quaternion rotOffset)
        {
            Util.ThrowIfNull(parent, "parent");
            Util.ThrowIfNull(child, "child");

            _parent        = parent;
            _child         = child;
            _newOffset     = newOffset;
            _rotOffset     = rotOffset;
            _affectedPrims = new List <PhysxPrim> {
                parent, child
            };
        }
Ejemplo n.º 17
0
        public PrepChildPrimAndLinkCmd(PhysxPrim parent, PhysxPrim child, OpenMetaverse.Vector3 localPos,
            OpenMetaverse.Quaternion localRot)
        {
            Util.ThrowIfNull(parent, "parent");
            Util.ThrowIfNull(child, "child");

            _parent = parent;
            _child = child;
            _localPos = localPos;
            _localRot = localRot;
            _newShape = null;
            _affectedPrims = new List<PhysxPrim> { parent, child };
            _affectedPrims.AddRange(child.ChildShapes.Keys);
        }
Ejemplo n.º 18
0
        public PrepChildPrimAndLinkCmd(PhysxPrim parent, PhysxPrim child, OpenMetaverse.Vector3 localPos,
                                       OpenMetaverse.Quaternion localRot)
        {
            Util.ThrowIfNull(parent, "parent");
            Util.ThrowIfNull(child, "child");

            _parent        = parent;
            _child         = child;
            _localPos      = localPos;
            _localRot      = localRot;
            _newShape      = null;
            _affectedPrims = new List <PhysxPrim> {
                parent, child
            };
            _affectedPrims.AddRange(child.ChildShapes.Keys);
        }
Ejemplo n.º 19
0
        private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
        {
            Vec3 pos = new Vec3();

            pos.X = position.X;
            pos.Y = position.Y;
            pos.Z = position.Z;
            Vec3 siz = new Vec3();

            siz.X = size.X;
            siz.Y = size.Y;
            siz.Z = size.Z;
            PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));

            _prims.Add(act);
            return(act);
        }
Ejemplo n.º 20
0
        private void ChangeToChild(BasicPrim parent, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            _parentPrim = parent;

            //this prim no longer has its old shape or its actor
            //_scene.PrimBecameChild(this);

            //if we have children, we need to unref their shapes here, as our new parent (ours and our children)
            //may require different shape types and will be rebuilt
            //this.DeleteActor(_actor, _myShape, _isPhysical, DeleteActorFlags.UnrefChildShapes);

            //_actor = null;
            //_dynActor = null;
            //_myShape = null;

            _position = localPos;
            _rotation = localRot;
        }
Ejemplo n.º 21
0
        public BasicPrim(BasicPrim parent, BasicScene scene, PrimitiveBaseShape baseShape, OpenMetaverse.Vector3 pos,
                         OpenMetaverse.Quaternion rotation, /*PhysicsShape myShape, PhysX.RigidActor myActor,*/
                         bool isPhysical, IPhysicsProperties properties /*, CollisionGroupFlag collisionGroup*/)
        {
            _parentPrim = parent;
            _scene      = scene;
            _pbs        = baseShape;
            _position   = pos;
            _rotation   = rotation;
            _isPhysical = isPhysical;
            _properties = (BasicPhysicsProperties)properties;
            //_collisionGroup = collisionGroup;

            _acceleration = OpenMetaverse.Vector3.Zero;

            _mass = OBJECT_DENSITY * _pbs.Scale.X * _pbs.Scale.Y * _pbs.Scale.Z;

            //this.AssignActor(myActor, myShape, _isPhysical, DeleteActorFlags.None);
        }
Ejemplo n.º 22
0
 public CreateObjectCmd(PhysxPrim parent, string primName, OpenSim.Framework.PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
     OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector3 velocity, OpenMetaverse.Vector3 angularVelocity,
     float lod, PhysicsScene.AddPrimShapeFlags flags, Material material, byte[] serializedPhysicsProperties, byte[] serializedPhysicsShapes,
     ulong interpolateTime)
 {
     _parent = parent;
     _primName = primName;
     _pbs = pbs;
     _position = position;
     _size = size;
     _rotation = rotation;
     _velocity = velocity;
     _angularVelocity = angularVelocity;
     _lod = lod;
     _flags = flags;
     _material = material;
     _serializedPhysicsProperties = serializedPhysicsProperties;
     _serializedPhysicsShapes = serializedPhysicsShapes;
     _interpolateTime = interpolateTime;
 }
Ejemplo n.º 23
0
 public CreateObjectCmd(PhysxPrim parent, string primName, OpenSim.Framework.PrimitiveBaseShape pbs, OpenMetaverse.Vector3 position,
                        OpenMetaverse.Vector3 size, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector3 velocity, OpenMetaverse.Vector3 angularVelocity,
                        float lod, PhysicsScene.AddPrimShapeFlags flags, Material material, byte[] serializedPhysicsProperties, byte[] serializedPhysicsShapes,
                        ulong interpolateTime)
 {
     _parent                      = parent;
     _primName                    = primName;
     _pbs                         = pbs;
     _position                    = position;
     _size                        = size;
     _rotation                    = rotation;
     _velocity                    = velocity;
     _angularVelocity             = angularVelocity;
     _lod                         = lod;
     _flags                       = flags;
     _material                    = material;
     _serializedPhysicsProperties = serializedPhysicsProperties;
     _serializedPhysicsShapes     = serializedPhysicsShapes;
     _interpolateTime             = interpolateTime;
 }
Ejemplo n.º 24
0
 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
                                           PhysicsVector size, Quaternion rotation, bool isPhysical)
 {
     return(AddPrim(position, size, rotation));
 }
Ejemplo n.º 25
0
 public SetRotationCmd(PhysxPrim prim, OpenMetaverse.Quaternion newRot)
 {
     _prim = prim;
     _newRotation = newRot;
 }
        /**
         * @brief Add arbitrary constant available to script compilation.
         * CAUTION: These values get compiled-in to a script and must not
         *          change over time as previously compiled scripts will
         *          still have the old values.
         */
        public static ScriptConst AddConstant(string name, object value)
        {
            CompValu cv = null;

            if (value is char)
            {
                cv = new CompValuChar(new TokenTypeChar(null), (char)value);
            }
            else if (value is double)
            {
                cv = new CompValuFloat(new TokenTypeFloat(null), (double)(double)value);
            }
            else if (value is float)
            {
                cv = new CompValuFloat(new TokenTypeFloat(null), (double)(float)value);
            }
            else if (value is int)
            {
                cv = new CompValuInteger(new TokenTypeInt(null), (int)value);
            }
            else if (value is string)
            {
                cv = new CompValuString(new TokenTypeStr(null), (string)value);
            }

            else if (value is LSL_Float)
            {
                cv = new CompValuFloat(new TokenTypeFloat(null), (double)((LSL_Float)value).value);
            }
            else if (value is LSL_Integer)
            {
                cv = new CompValuInteger(new TokenTypeInt(null), ((LSL_Integer)value).value);
            }
            else if (value is LSL_Rotation)
            {
                LSL_Rotation r = (LSL_Rotation)value;
                CompValu     x = new CompValuFloat(new TokenTypeFloat(null), r.x);
                CompValu     y = new CompValuFloat(new TokenTypeFloat(null), r.y);
                CompValu     z = new CompValuFloat(new TokenTypeFloat(null), r.z);
                CompValu     s = new CompValuFloat(new TokenTypeFloat(null), r.s);
                cv = new CompValuRot(new TokenTypeRot(null), x, y, z, s);
            }
            else if (value is LSL_String)
            {
                cv = new CompValuString(new TokenTypeStr(null), (string)(LSL_String)value);
            }
            else if (value is LSL_Vector)
            {
                LSL_Vector v = (LSL_Vector)value;
                CompValu   x = new CompValuFloat(new TokenTypeFloat(null), v.x);
                CompValu   y = new CompValuFloat(new TokenTypeFloat(null), v.y);
                CompValu   z = new CompValuFloat(new TokenTypeFloat(null), v.z);
                cv = new CompValuVec(new TokenTypeVec(null), x, y, z);
            }

            else if (value is OpenMetaverse.Quaternion)
            {
                OpenMetaverse.Quaternion r = (OpenMetaverse.Quaternion)value;
                CompValu x = new CompValuFloat(new TokenTypeFloat(null), r.X);
                CompValu y = new CompValuFloat(new TokenTypeFloat(null), r.Y);
                CompValu z = new CompValuFloat(new TokenTypeFloat(null), r.Z);
                CompValu s = new CompValuFloat(new TokenTypeFloat(null), r.W);
                cv = new CompValuRot(new TokenTypeRot(null), x, y, z, s);
            }
            else if (value is OpenMetaverse.UUID)
            {
                cv = new CompValuString(new TokenTypeKey(null), value.ToString());
            }
            else if (value is OpenMetaverse.Vector3)
            {
                OpenMetaverse.Vector3 v = (OpenMetaverse.Vector3)value;
                CompValu x = new CompValuFloat(new TokenTypeFloat(null), v.X);
                CompValu y = new CompValuFloat(new TokenTypeFloat(null), v.Y);
                CompValu z = new CompValuFloat(new TokenTypeFloat(null), v.Z);
                cv = new CompValuVec(new TokenTypeVec(null), x, y, z);
            }

            if (cv == null)
            {
                throw new Exception("bad type " + value.GetType().Name);
            }
            return(new ScriptConst(scriptConstants, name, cv));
        }
Ejemplo n.º 27
0
        protected OpenMetaverse.Quaternion parseRotation(XmlElement XMLNode)
        {
            OpenMetaverse.Quaternion orientation = new OpenMetaverse.Quaternion();

            orientation.X = ParseFloat(XMLNode.GetAttribute("qx"));
            orientation.Y = ParseFloat(XMLNode.GetAttribute("qy"));
            orientation.Z = ParseFloat(XMLNode.GetAttribute("qz"));
            orientation.W = ParseFloat(XMLNode.GetAttribute("qw"));

            return orientation;
        }
Ejemplo n.º 28
0
 private PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation)
 {
     Vec3 pos = new Vec3();
     pos.X = position.X;
     pos.Y = position.Y;
     pos.Z = position.Z;
     Vec3 siz = new Vec3();
     siz.X = size.X;
     siz.Y = size.Y;
     siz.Z = size.Z;
     PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz));
     _prims.Add(act);
     return act;
 }
Ejemplo n.º 29
0
 public void AttachObject(uint localID, OpenMetaverse.Quaternion rotation, byte attachPoint, OpenMetaverse.UUID ownerID)
 {
 }
Ejemplo n.º 30
0
 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, OpenMetaverse.UUID avatarID, uint avatarLocalID,
                            OpenMetaverse.Vector3 Pos, byte[] textureEntry, uint parentID, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector4 collisionPlane,
                            OpenMetaverse.Vector3 velocity, bool immediate)
 {
 }
Ejemplo n.º 31
0
        public override void DelinkFromParent(OpenMetaverse.Vector3 newWorldPosition, OpenMetaverse.Quaternion newWorldRotation)
        {
            lock (_terseConsistencyLock)
            {
                _position = newWorldPosition;
                _rotation = newWorldRotation;
            }

            _parentPrim = null;
        }
Ejemplo n.º 32
0
        public BasicPrim(BasicPrim parent, BasicScene scene, PrimitiveBaseShape baseShape, OpenMetaverse.Vector3 pos,
            OpenMetaverse.Quaternion rotation, /*PhysicsShape myShape, PhysX.RigidActor myActor,*/
            bool isPhysical, IPhysicsProperties properties/*, CollisionGroupFlag collisionGroup*/)
        {
            _parentPrim = parent;
            _scene = scene;
            _pbs = baseShape;
            _position = pos;
            _rotation = rotation;
            _isPhysical = isPhysical;
            _properties = (BasicPhysicsProperties)properties;
            //_collisionGroup = collisionGroup;

            _acceleration = OpenMetaverse.Vector3.Zero;

            _mass = OBJECT_DENSITY * _pbs.Scale.X * _pbs.Scale.Y * _pbs.Scale.Z;

            //this.AssignActor(myActor, myShape, _isPhysical, DeleteActorFlags.None);
        }
Ejemplo n.º 33
0
        public override void DelinkFromParent(OpenMetaverse.Vector3 newWorldPosition, OpenMetaverse.Quaternion newWorldRotation)
        {
            lock (_terseConsistencyLock)
            {
                _position = newWorldPosition;
                _rotation = newWorldRotation;
            }

            _scene.QueueCommand(new Commands.UnlinkFromParentCmd(this, _parentPrim, newWorldPosition, newWorldRotation));
        }
Ejemplo n.º 34
0
        //public override void SetMaterial(IMaterial 

        public override void LinkToNewParent(PhysicsActor obj, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            lock (_terseConsistencyLock)
            {
                _position = localPos;
                _rotation = localRot;
            }

            _scene.QueueCommand(new Commands.PrepChildPrimAndLinkCmd((PhysxPrim)obj, this, localPos, localRot));
        }
Ejemplo n.º 35
0
        public PhysxPrim(PhysxPrim parent, PhysxScene scene, PrimitiveBaseShape baseShape, OpenMetaverse.Vector3 pos,
            OpenMetaverse.Quaternion rotation, PhysicsShape myShape, PhysX.RigidActor myActor,
            bool isPhysical, IPhysicsProperties properties, CollisionGroupFlag collisionGroup)
        {
            _parentPrim = parent;
            _scene = scene;
            _pbs = baseShape;
            _position = pos;
            _rotation = rotation;
            _isPhysical = isPhysical;
            _properties = (PhysicsProperties)properties;
            _collisionGroup = collisionGroup;

            this.AssignActor(myActor, myShape, _isPhysical, DeleteActorFlags.None);

            if (_properties.VehicleProps != null && _properties.VehicleProps.Type != VehicleType.None)
            {
                //init dynamics
                CheckCreateVehicleDynamics();
            }
        }
Ejemplo n.º 36
0
 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
                                           PhysicsVector size, Quaternion rotation) //To be removed
 {
     return AddPrimShape(primName, pbs, position, size, rotation, false);
 }
Ejemplo n.º 37
0
        /// <summary>
        /// Unlinks this prim from its parent
        /// </summary>
        /// <param name="newWorldPosition">The new position for the new physics actor</param>
        /// <param name="newWorldRotation">The new rotation for the new physics actor</param>
        internal void UnlinkFromParent(OpenMetaverse.Vector3 newWorldPosition,
            OpenMetaverse.Quaternion newWorldRotation)
        {
            if (_parentPrim == null) return;

            bool physical = _parentPrim.IsPhysical;

            _position = newWorldPosition;
            _rotation = newWorldRotation;

            PhysicsShape childShape = _parentPrim.UnlinkChild(this);
            _parentPrim = null;

            if (childShape != null)
            {
                this.RebuildPhysxActorWithNewShape(childShape, null, physical, true);
            }
        }
Ejemplo n.º 38
0
        public override void LinkToNewParent(PhysicsActor obj, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            lock (_terseConsistencyLock)
            {
                _position = localPos;
                _rotation = localRot;
            }

            _parentPrim = (BasicPrim)obj;
        }
Ejemplo n.º 39
0
 public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 velocity, OpenMetaverse.Vector3 acceleration, OpenMetaverse.Quaternion rotation, OpenMetaverse.UUID agentid, OpenMetaverse.Vector4 collisionPlane)
 {
 }
Ejemplo n.º 40
0
        private void ChangeToChild(PhysxPrim parent, OpenMetaverse.Vector3 localPos, OpenMetaverse.Quaternion localRot)
        {
            _parentPrim = parent;

            //this prim no longer has its old shape or its actor
            _scene.PrimBecameChild(this);

            //if we have children, we need to unref their shapes here, as our new parent (ours and our children)
            //may require different shape types and will be rebuilt
            this.DeleteActor(_actor, _myShape, _isPhysical, DeleteActorFlags.UnrefChildShapes);

            _actor = null;
            _dynActor = null;
            _myShape = null;

            _position = localPos;
            _rotation = localRot;
        }
Ejemplo n.º 41
0
 public void SendSitResponse(OpenMetaverse.UUID TargetID, OpenMetaverse.Vector3 OffsetPos, OpenMetaverse.Quaternion SitOrientation, bool autopilot, OpenMetaverse.Vector3 CameraAtOffset, OpenMetaverse.Vector3 CameraEyeOffset, bool ForceMouseLook)
 {
 }
Ejemplo n.º 42
0
 public BasicPrim(BasicScene scene, PrimitiveBaseShape baseShape, OpenMetaverse.Vector3 pos,
                  OpenMetaverse.Quaternion rotation, /*PhysicsShape myShape, PhysX.RigidActor myActor,*/
                  bool isPhysical, IPhysicsProperties properties /*, CollisionGroupFlag collisionGroup*/)
     : this(null, scene, baseShape, pos, rotation, /*myShape, myActor,*/ isPhysical, properties /*, collisionGroup*/)
 {
 }
Ejemplo n.º 43
0
 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
                                           PhysicsVector size, Quaternion rotation, bool isPhysical)
 {
     return AddPrim(position, size, rotation);
 }
Ejemplo n.º 44
0
 private void CheckSyncRotation()
 {
     //check my rotation
     _rotation = GetRotationFromActor();
 }
Ejemplo n.º 45
0
        public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion rotation, OpenMetaverse.Vector3 size, bool isFlying, OpenMetaverse.Vector3 initialVelocity)
        {
            Commands.CreateCharacterCmd cmd = new Commands.CreateCharacterCmd(size.Z, size.X, position, rotation, isFlying, initialVelocity);
            this.QueueCommand(cmd);

            cmd.FinshedEvent.Wait();
            cmd.Dispose();

            return(cmd.FinalActor);
        }
Ejemplo n.º 46
0
 public SetRotationCmd(PhysxPrim prim, OpenMetaverse.Quaternion newRot)
 {
     _prim        = prim;
     _newRotation = newRot;
 }
Ejemplo n.º 47
0
 public Quaternion(OMV_Quaternion rot)
 {
     x = rot.X;
     y = rot.Y;
     z = rot.Z;
     s = rot.W;
 }
Ejemplo n.º 48
0
        public PhysxCharacter(PhysxScene scene, float height, float radius,
            OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion rotation,
            bool flying, OpenMetaverse.Vector3 initialVelocity)
        {
            _scene = scene;

            _radius = Math.Max(radius, 0.2f);

            /*
             * The capsule is defined as a position, a vertical height, and a radius. The height is the distance between the 
             * two sphere centers at the end of the capsule. In other words:
             *
             *   p = pos (returned by controller)
             *   h = height
             *   r = radius
             *
             *   p = center of capsule
             *   top sphere center = p.y + h*0.5
             *   bottom sphere center = p.y - h*0.5
             *   top capsule point = p.y + h*0.5 + r
             *   bottom capsule point = p.y - h*0.5 - r
             */
            _height = height;
            
            _flying = flying;

            float volume = (float)(Math.PI * Math.Pow(_radius, 2) * this.CapsuleHeight);
            _mass = CHARACTER_DENSITY * volume;

            _position = position;
            _rotation = rotation;
           
            _hitReportDelegator = new UserControllerHitReportDelegator();
            _hitReportDelegator.OnShapeHitCallback += this.OnShapeHit;
            _hitReportDelegator.OnControllerHitCallback += this.OnControllerHit;

            PhysX.CapsuleControllerDesc controllerDesc = new PhysX.CapsuleControllerDesc
            {
                Height = this.CapsuleHeight,
                Radius = _radius,
                StepOffset = STEP_OFFSET,
                UpDirection = new PhysX.Math.Vector3(0.0f, 0.0f, 1.0f),
                Position = PhysUtil.OmvVectorToPhysx(position),
                Material = scene.DEFAULT_MATERIAL,
                InteractionMode = PhysX.CCTInteractionMode.Include,
                SlopeLimit = (float)Math.Cos(OpenMetaverse.Utils.DEG_TO_RAD * MAX_WALKABLE_SLOPE),
                ContactOffset = CONTACT_OFFSET,
                Callback = _hitReportDelegator,
                BehaviorCallback = _rideOnBehavior
            };

            _controller = _scene.ControllerManager.CreateController<PhysX.CapsuleController>(controllerDesc);
            _controller.Actor.UserData = this;

            DoZDepenetration();

            _controller.ShapeFilterData = CollisionGroup.GetFilterData((uint)(PhysX.PairFlag.NotifyTouchFound | PhysX.PairFlag.NotifyTouchLost),
                0, CollisionGroupFlag.Character);
            
            _lastSync = (uint)Environment.TickCount;

            _vTarget = initialVelocity;
            _velocity = initialVelocity;
            if (_vTarget != OpenMetaverse.Vector3.Zero)
            {
                //hack to continue at velocity until the controller picks up
                _lastVelocityNonZero = OpenSim.Framework.Util.GetLongTickCount() - VELOCITY_RAMPUP_TIME;
            }
        }
Ejemplo n.º 49
0
 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
                                           PhysicsVector size, Quaternion rotation) //To be removed
 {
     return(AddPrimShape(primName, pbs, position, size, rotation, false));
 }
Ejemplo n.º 50
0
        private float CalculateDepenetrationZOffset(OpenMetaverse.Vector3 pos, PhysX.Geometry avaGeom, PhysX.Shape avaShape)
        {
            const int MAX_ITERATIONS = 8;
            const float PUSH_MULTIPLIER = 1.5F;
            float pushFactor = 0.1f;

            OpenMetaverse.Vector3 offset = OpenMetaverse.Vector3.Zero;

            bool foundOverlap = false;

            //constant from looking at the rot returned from the live avatar,
            //remember that capsules are always upright, and z rotations don't have an effect
            //on their geometry
            OpenMetaverse.Quaternion capsuleRot = new OpenMetaverse.Quaternion(0f, -0.7071069f, 0f, 0.7071067f);

            for (int i = 0; i < MAX_ITERATIONS; i++)
            {
                foundOverlap = false;
                OpenMetaverse.Vector3 translatedPose = pos + offset;
                PhysX.Shape[] overlap = _scene.SceneImpl.OverlapMultiple(avaGeom, PhysUtil.PositionToMatrix(translatedPose, capsuleRot));

                if (overlap == null)
                {
                    foundOverlap = true;
                }
                else
                {
                    foreach (var shape in overlap)
                    {
                        if (shape != avaShape && !ShapeIsVolumeDetect(shape))
                        {
                            foundOverlap = true;
                            break;
                        }
                    }
                }

                if (foundOverlap && i + 1 < MAX_ITERATIONS)
                {
                    offset += new OpenMetaverse.Vector3(0f, 0f, pushFactor);
                    pushFactor *= PUSH_MULTIPLIER;
                }
                else
                {
                    break;
                }
            }

            if (foundOverlap == false && offset != OpenMetaverse.Vector3.Zero)
            {
                return offset.Z;
            }

            return 0.0f;
        }
Ejemplo n.º 51
0
 public override void VehicleRotationParam(int param, Quaternion rotation)
 {
 }
Ejemplo n.º 52
0
 public void SendTelehubInfo(OpenMetaverse.Vector3 TelehubPos, OpenMetaverse.Quaternion TelehubRot, List <OpenMetaverse.Vector3> SpawnPoint, OpenMetaverse.UUID ObjectID, string nameT)
 {
 }
Ejemplo n.º 53
0
        public override void VehicleRotationParam(int param, Quaternion rotation)
        {

        }
Ejemplo n.º 54
0
        public override void UpdateOffsetPosition(OpenMetaverse.Vector3 newOffset, OpenMetaverse.Quaternion rotOffset)
        {
            //Offset updates are only handled for child prims. Upstream a non child move is 
            //handled by setting our position directly
            if (IsChild)
            {
                _position = newOffset;
                _rotation = rotOffset;

                _parentPrim.ChildPrimOffsetChanged(this, newOffset, rotOffset);
            }
        }