コード例 #1
0
        // Create the correct type of linkset for this child
        public static BSLinkset Factory(BSScene physScene, BSPrimLinkable parent)
        {
            BSLinkset ret = null;

            switch (parent.LinksetType)
            {
            case LinksetImplementation.Constraint:
                ret = new BSLinksetConstraints(physScene, parent);
                break;

            case LinksetImplementation.Compound:
                ret = new BSLinksetCompound(physScene, parent);
                break;

            case LinksetImplementation.Manual:
                // ret = new BSLinksetManual(physScene, parent);
                break;

            default:
                ret = new BSLinksetCompound(physScene, parent);
                break;
            }
            if (ret == null)
            {
                physScene.Logger.ErrorFormat("[BULLETSIM LINKSET] Factory could not create linkset. Parent name={1}, ID={2}", parent.Name, parent.LocalID);
            }
            return(ret);
        }
コード例 #2
0
        public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                              OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
            : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
        {
            // Default linkset implementation for this prim
            LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation;

            Linkset = BSLinkset.Factory(PhysScene, this);

            Linkset.Refresh(this);
        }
コード例 #3
0
        public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                              OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
            : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
        {
            Linkset = BSLinkset.Factory(PhysScene, this);

            PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
            {
                Linkset.Refresh(this);
            });
        }
コード例 #4
0
ファイル: BSPhysObject.cs プロジェクト: MAReantals/opensim
    protected void BaseInitialize(BSScene parentScene, uint localID, string name, string typeName)
    {
        PhysicsScene = parentScene;
        LocalID = localID;
        PhysObjectName = name;
        TypeName = typeName;

        Linkset = new BSLinkset(PhysicsScene, this);

        CollisionCollection = new CollisionEventUpdate();
        SubscribedEventsMs = 0;
        CollidingStep = 0;
        CollidingGroundStep = 0;
    }
コード例 #5
0
ファイル: BSPhysObject.cs プロジェクト: p07r0457/opensim
        protected void BaseInitialize(BSScene parentScene, uint localID, string name, string typeName)
        {
            PhysicsScene   = parentScene;
            LocalID        = localID;
            PhysObjectName = name;
            TypeName       = typeName;

            Linkset = new BSLinkset(PhysicsScene, this);

            CollisionCollection = new CollisionEventUpdate();
            SubscribedEventsMs  = 0;
            CollidingStep       = 0;
            CollidingGroundStep = 0;
        }
コード例 #6
0
ファイル: BSLinkset.cs プロジェクト: justasabc/wifi
        // Remove a child from a linkset.
        // Returns a new linkset for the child which is a linkset of one (just the
        //    orphened child).
        // Called at runtime.
        public BSLinkset RemoveMeFromLinkset(BSPhysObject child)
        {
            lock (m_linksetActivityLock)
            {
                if (IsRoot(child))
                {
                    // Cannot remove the root from a linkset.
                    return(this);
                }
                RemoveChildFromLinkset(child);
                LinksetMass = ComputeLinksetMass();
            }

            // The child is down to a linkset of just itself
            return(BSLinkset.Factory(PhysicsScene, child));
        }
コード例 #7
0
        // Convert the existing linkset of this prim into a new type.
        public bool ConvertLinkset(BSLinkset.LinksetImplementation newType)
        {
            bool ret = false;

            if (LinksetType != newType)
            {
                DetailLog("{0},BSPrimLinkable.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType);

                // Set the implementation type first so the call to BSLinkset.Factory gets the new type.
                this.LinksetType = newType;

                BSLinkset oldLinkset = this.Linkset;
                BSLinkset newLinkset = BSLinkset.Factory(PhysScene, this);

                this.Linkset = newLinkset;

                // Pick up any physical dependencies this linkset might have in the physics engine.
                oldLinkset.RemoveDependencies(this);

                // Create a list of the children (mainly because can't interate through a list that's changing)
                List <BSPrimLinkable> children = new List <BSPrimLinkable>();
                oldLinkset.ForEachMember((child) =>
                {
                    if (!oldLinkset.IsRoot(child))
                    {
                        children.Add(child);
                    }
                    return(false); // 'false' says to continue to next member
                });

                // Remove the children from the old linkset and add to the new (will be a new instance from the factory)
                foreach (BSPrimLinkable child in children)
                {
                    oldLinkset.RemoveMeFromLinkset(child, true /*inTaintTime*/);
                }
                foreach (BSPrimLinkable child in children)
                {
                    newLinkset.AddMeToLinkset(child);
                    child.Linkset = newLinkset;
                }

                // Force the shape and linkset to get reconstructed
                newLinkset.Refresh(this);
                this.ForceBodyShapeRebuild(true /* inTaintTime */);
            }
            return(ret);
        }
コード例 #8
0
        public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
                              OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical, int material, float friction,
                              float restitution, float gravityMultiplier, float density)
            : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
        {
            Linkset = BSLinkset.Factory(PhysicsScene, this);

            PhysicsScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
            {
                base.SetMaterial(material);
                base.Friction          = friction;
                base.Restitution       = restitution;
                base.GravityMultiplier = gravityMultiplier;
                base.Density           = density;
                Linkset.Refresh(this);
            });
        }
コード例 #9
0
        // Remove a child from a linkset.
        // Returns a new linkset for the child which is a linkset of one (just the
        //    orphened child).
        // Called at runtime.
        public BSLinkset RemoveMeFromLinkset(BSPrimLinkable child, bool inTaintTime)
        {
            m_linksetActivityLock.AcquireWriterLock(-1);
            try
            {
                if (IsRoot(child))
                {
                    // Cannot remove the root from a linkset.
                    return(this);
                }
                RemoveChildFromLinkset(child, inTaintTime);
                LinksetMass = ComputeLinksetMass();
            }
            finally
            {
                m_linksetActivityLock.ReleaseWriterLock();
            }

            // The child is down to a linkset of just itself
            return(BSLinkset.Factory(m_physicsScene, child));
        }
コード例 #10
0
        protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
        {
            PhysicsScene   = parentScene;
            LocalID        = localID;
            PhysObjectName = name;
            TypeName       = typeName;

            // We don't have any physical representation yet.
            PhysBody  = new BulletBody(localID);
            PhysShape = new BulletShape();

            // A linkset of just me
            Linkset = BSLinkset.Factory(PhysicsScene, this);
            LastAssetBuildFailed = false;

            // Default material type
            Material = MaterialAttributes.Material.Wood;

            CollisionCollection = new CollisionEventUpdate();
            SubscribedEventsMs  = 0;
            CollidingStep       = 0;
            CollidingGroundStep = 0;
        }
コード例 #11
0
ファイル: BSLinkset.cs プロジェクト: justasabc/wifi
        // Create the correct type of linkset for this child
        public static BSLinkset Factory(BSScene physScene, BSPhysObject parent)
        {
            BSLinkset ret = null;

            switch ((int)BSParam.LinksetImplementation)
            {
            case (int)LinksetImplementation.Constraint:
                ret = new BSLinksetConstraints(physScene, parent);
                break;

            case (int)LinksetImplementation.Compound:
                ret = new BSLinksetCompound(physScene, parent);
                break;

            case (int)LinksetImplementation.Manual:
                // ret = new BSLinksetManual(physScene, parent);
                break;

            default:
                ret = new BSLinksetCompound(physScene, parent);
                break;
            }
            return(ret);
        }
コード例 #12
0
ファイル: BSPrimLinkable.cs プロジェクト: AkiraSonoda/akisim
    // Convert the existing linkset of this prim into a new type.
    public bool ConvertLinkset(BSLinkset.LinksetImplementation newType)
    {
        bool ret = false;
        if (LinksetType != newType)
        {
            DetailLog("{0},BSPrimLinkable.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType);

            // Set the implementation type first so the call to BSLinkset.Factory gets the new type.
            this.LinksetType = newType;

            BSLinkset oldLinkset = this.Linkset;
            BSLinkset newLinkset = BSLinkset.Factory(PhysScene, this);

            this.Linkset = newLinkset;

            // Pick up any physical dependencies this linkset might have in the physics engine.
            oldLinkset.RemoveDependencies(this);

            // Create a list of the children (mainly because can't interate through a list that's changing)
            List<BSPrimLinkable> children = new List<BSPrimLinkable>();
            oldLinkset.ForEachMember((child) =>
            {
                if (!oldLinkset.IsRoot(child))
                    children.Add(child);
                return false;   // 'false' says to continue to next member
            });

            // Remove the children from the old linkset and add to the new (will be a new instance from the factory)
            foreach (BSPrimLinkable child in children)
            {
                oldLinkset.RemoveMeFromLinkset(child, true /*inTaintTime*/);
            }
            foreach (BSPrimLinkable child in children)
            {
                newLinkset.AddMeToLinkset(child);
                child.Linkset = newLinkset;
            }

            // Force the shape and linkset to get reconstructed
            newLinkset.Refresh(this);
            this.ForceBodyShapeRebuild(true /* inTaintTime */);
        }
        return ret;
    }