Example #1
0
        // called when this character is being destroyed and the resources should be released
        public override void Destroy()
        {
            base.Destroy();

            DetailLog("{0},BSCharacter.Destroy", LocalID);
            PhysScene.TaintedObject("BSCharacter.destroy", delegate()
            {
                PhysScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */);
                PhysBody.Clear();
                PhysShape.Dereference(PhysScene);
                PhysShape = new BSShapeNull();
            });
        }
Example #2
0
        protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
        {
            IsInitialized = false;

            PhysScene      = parentScene;
            LocalID        = localID;
            PhysObjectName = name;
            Name           = name; // PhysicsActor also has the name of the object. Someday consolidate.
            TypeName       = typeName;

            // The collection of things that push me around
            PhysicalActors = new BSActorCollection(PhysScene);

            // Initialize variables kept in base.
            GravModifier = 1.0f;
            Gravity      = new OMV.Vector3(0f, 0f, BSParam.Gravity);
            HoverActive  = false;

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

            UserSetCenterOfMassDisplacement = null;

            PrimAssetState = PrimAssetCondition.Unknown;

            // Default material type. Also sets Friction, Restitution and Density.
            SetMaterial((int)MaterialAttributes.Material.Wood);

            CollisionCollection    = new CollisionEventUpdate();
            CollisionsLastReported = CollisionCollection;
            CollisionsLastTick     = new CollisionEventUpdate();
            CollisionsLastTickStep = -1;

            SubscribedEventsMs = 0;
            // Crazy values that will never be true
            CollidingStep         = BSScene.NotASimulationStep;
            CollidingGroundStep   = BSScene.NotASimulationStep;
            CollisionAccumulation = BSScene.NotASimulationStep;
            ColliderIsMoving      = false;
            CollisionScore        = 0;

            // All axis free.
            LockedLinearAxis  = LockedAxisFree;
            LockedAngularAxis = LockedAxisFree;
        }
Example #3
0
    // called when this character is being destroyed and the resources should be released
    public override void Destroy()
    {
        IsInitialized = false;

        base.Destroy();

        DetailLog("{0},BSCharacter.Destroy", LocalID);
        PhysScene.TaintedObject(LocalID, "BSCharacter.destroy", delegate()
        {
            PhysScene.Shapes.DereferenceBody(PhysBody, null /* bodyCallback */);
            PhysBody.Clear();
            PhysShape.Dereference(PhysScene);
            PhysShape = new BSShapeNull();
        });
    }
Example #4
0
    protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
    {
        IsInitialized = false;

        PhysScene = parentScene;
        LocalID = localID;
        PhysObjectName = name;
        Name = name;    // PhysicsActor also has the name of the object. Someday consolidate.
        TypeName = typeName;

        // The collection of things that push me around
        PhysicalActors = new BSActorCollection(PhysScene);

        // Initialize variables kept in base.
        GravModifier = 1.0f;
        Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
        HoverActive = false;

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

        UserSetCenterOfMassDisplacement = null;

        PrimAssetState = PrimAssetCondition.Unknown;

        // Default material type. Also sets Friction, Restitution and Density.
        SetMaterial((int)MaterialAttributes.Material.Wood);

        CollisionCollection = new CollisionEventUpdate();
        CollisionsLastReported = CollisionCollection;
        CollisionsLastTick = new CollisionEventUpdate();
        CollisionsLastTickStep = -1;

        SubscribedEventsMs = 0;
        // Crazy values that will never be true
        CollidingStep = BSScene.NotASimulationStep;
        CollidingGroundStep = BSScene.NotASimulationStep;
        CollisionAccumulation = BSScene.NotASimulationStep;
        ColliderIsMoving = false;
        CollisionScore = 0;

        // All axis free.
        LockedLinearAxis = LockedAxisFree;
        LockedAngularAxis = LockedAxisFree;
    }
    // called when this prim is being destroyed and we should free all the resources
    public override void Destroy()
    {
        // m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
        IsInitialized = false;

        base.Destroy();

        // Undo any vehicle properties
        this.VehicleType = (int)Vehicle.TYPE_NONE;

        PhysScene.TaintedObject("BSPrim.Destroy", delegate()
        {
            DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
            // If there are physical body and shape, release my use of same.
            PhysScene.Shapes.DereferenceBody(PhysBody, null);
            PhysBody.Clear();
            PhysShape.Dereference(PhysScene);
            PhysShape = new BSShapeNull();
        });
    }