示例#1
0
        public AuroraPhysXPrim(ISceneChildEntity entity, AuroraODEPhysicsScene parent_scene, bool pisPhysical, CollisionLocker dode)
        {
            m_vehicle = new AuroraPhysXDynamics ();
            //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
            ode = dode;

            PID_D = parent_scene.bodyPIDD;
            PID_G = parent_scene.bodyPIDG;

            // correct for changed timestep
            PID_D /= (parent_scene.ODE_STEPSIZE * 50f); // original ode fps of 50
            PID_G /= (parent_scene.ODE_STEPSIZE * 50f);

            // m_tensor = parent_scene.bodyMotorJointMaxforceTensor;
            body_autodisable_frames = parent_scene.bodyFramesAutoDisable;


            prim_geom = IntPtr.Zero;
            prev_geom = IntPtr.Zero;

            _size = entity.Scale;
            _position = entity.AbsolutePosition;
            fakepos = false;
            _orientation = entity.GetWorldRotation ();
            fakeori = false;
            _pbs = entity.Shape;
            _parent_entity = entity;

            _parent_scene = parent_scene;
            m_targetSpace = (IntPtr)0;

            m_isphysical = pisPhysical;
            // If we're physical, we need to be in the master space for now.
            // linksets *should* be in a space together..  but are not currently
            if (m_isphysical)
                m_targetSpace = _parent_scene.space;

            m_forceacc = Vector3.Zero;
            m_angularforceacc = Vector3.Zero;

            m_UpdateTimecntr = 0;
            m_UpdateFPScntr = 2.5f * parent_scene.StepTime; // this parameter needs retunning and possible came from ini file
            if (m_UpdateTimecntr > .1f) // try to keep it under 100ms
                m_UpdateTimecntr = .1f;

            AddChange (changes.Add, null);
        }
示例#2
0
        public AuroraODEPrim (ISceneChildEntity entity, AuroraODEPhysicsScene parent_scene, bool pisPhysical)
        {
            m_vehicle = new AuroraODEDynamics ();
            //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);

            PID_D = parent_scene.bodyPIDD;
            PID_G = parent_scene.bodyPIDG;

            // correct for changed timestep
            PID_D /= (parent_scene.ODE_STEPSIZE * 50f); // original ode fps of 50
            PID_G /= (parent_scene.ODE_STEPSIZE * 50f);

            body_autodisable_frames = parent_scene.bodyFramesAutoDisable;

            prim_geom = IntPtr.Zero;

            _size = entity.Scale;
            _position = entity.AbsolutePosition;
            fakepos = 0;
            _orientation = entity.GetWorldRotation ();
            fakeori = 0;
            _pbs = entity.Shape;
            _parent_entity = entity;

            _parent_scene = parent_scene;
            m_targetSpace = IntPtr.Zero;

            /*
                        m_isphysical = pisPhysical;
                        if (m_isphysical)
                            m_targetSpace = _parent_scene.space;
            */
            m_isphysical = false;

            m_forceacc = Vector3.Zero;
            m_angularforceacc = Vector3.Zero;

            hasOOBoffsetFromMesh = false;
            _triMeshData = IntPtr.Zero;

            CalcPrimBodyData();

            m_UpdateTimecntr = 0;
            m_UpdateFPScntr = 2.5f * parent_scene.StepTime; // this parameter needs retunning and possible came from ini file
            if (m_UpdateTimecntr > .1f) // try to keep it under 100ms
                m_UpdateTimecntr = .1f;

            AddChange (changes.Add, null);
        }
示例#3
0
 private LSL_Rotation GetPartRot (ISceneChildEntity part)
 {
     Quaternion q;
     if (part.LinkNum == 0 || part.LinkNum == 1) // unlinked or root prim
     {
         if (part.ParentEntity.RootChild.AttachmentPoint != 0)
         {
             IScenePresence avatar = World.GetScenePresence(part.AttachedAvatar);
             if (avatar != null)
             {
                 if ((avatar.AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0)
                     q = avatar.CameraRotation; // Mouselook
                 else
                     q = avatar.Rotation; // Currently infrequently updated so may be inaccurate
             }
             else
                 q = part.ParentEntity.GroupRotation; // Likely never get here but just in case
         }
         else
             q = part.ParentEntity.GroupRotation; // just the group rotation
         return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
     }
     q = part.GetWorldRotation();
     return new LSL_Rotation(q.X, q.Y, q.Z, q.W);
 }
示例#4
0
        private Vector3 showposition; // a temp hack for now rest of code expects position to be changed immediately

        public AuroraODEPrim(ISceneChildEntity entity, AuroraODEPhysicsScene parent_scene, bool pisPhysical)
        {
            m_vehicle = new AuroraODEDynamics();
            //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);

            // correct for changed timestep
            PID_D /= (parent_scene.ODE_STEPSIZE * 50f); // original ode fps of 50
            PID_G /= (parent_scene.ODE_STEPSIZE * 50f);

            body_autodisable_frames = parent_scene.bodyFramesAutoDisable;

            prim_geom = IntPtr.Zero;

            _size = entity.Scale;
            _position = entity.AbsolutePosition;
            fakepos = 0;
            _orientation = entity.GetWorldRotation();
            fakeori = 0;
            _pbs = entity.Shape;
            _parent_entity = entity;

            _parent_scene = parent_scene;
            m_targetSpace = IntPtr.Zero;

            /*
                        m_isphysical = pisPhysical;
                        if (m_isphysical)
                            m_targetSpace = _parent_scene.space;
            */
            m_isphysical = false;

            m_forceacc = Vector3.Zero;
            m_angularforceacc = Vector3.Zero;

            hasOOBoffsetFromMesh = false;
            _triMeshData = IntPtr.Zero;

            CalcPrimBodyData();

            _parent_scene.AddSimulationChange(() => changeadd());
        }