//public class FallingPrim
        //{
        //public bool DoneMoving = false;
        //public uint localId;

        public void FallingPrim(OdeScene ps, CollisionPlane Plane, PhysicsVector position, int x, int y, float offsetZ)
        {
            uint localId = Plane.fallingPrims;
            PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
            OdePrim            oprim   = (OdePrim)ps.AddPrimShape("FallingPrim_" + localId, newcube, position, new PhysicsVector(0.1f, 0.1f, 2f), Quaternion.Identity, true);

            oprim.LocalID            = localId + 100000;
            oprim.OnCollisionUpdate += delegate(EventArgs args)
            {
                if (!oprim.m_taintremove)
                {
                    // CollisionEventUpdate arg = (CollisionEventUpdate)args;
                    //simhinfo 58 58 30
                    // DoneMoving = true;
                    LandingHieghts[x, y] = oprim.Position.Z + offsetZ;
                    fallingPrims--;
                    ps.remCollisionEventReporting(oprim);
                    ps.RemovePrim(oprim);
                }
            };
            oprim.SubscribeEvents(30000);
        }
示例#2
0
        //public class FallingPrim
        //{
             //public bool DoneMoving = false;
             //public uint localId;

            public void FallingPrim(OdeScene ps, CollisionPlane Plane, PhysicsVector position, int x, int y, float offsetZ)
            {
                uint localId = Plane.fallingPrims;
                PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
                OdePrim oprim = (OdePrim)ps.AddPrimShape("FallingPrim_" + localId, newcube, position, new PhysicsVector(0.1f, 0.1f, 2f), Quaternion.Identity, true);
                oprim.LocalID = localId + 100000;
                oprim.OnCollisionUpdate += delegate(EventArgs args)
                {
                    if (!oprim.m_taintremove)
                    {
                       // CollisionEventUpdate arg = (CollisionEventUpdate)args;
                        //simhinfo 58 58 30
                       // DoneMoving = true;
                        LandingHieghts[x, y] = oprim.Position.Z + offsetZ;
                        fallingPrims--;
                        ps.remCollisionEventReporting(oprim);
                        ps.RemovePrim(oprim);
                    }
                };
                oprim.SubscribeEvents(30000);
            }