Example #1
0
File: Setup.cs Project: zarlant/ACE
        public static Setup MakeSimpleSetup(uint gfxObjID)
        {
            var setup = new Setup();

            setup.NumParts = 1;
            setup.Parts    = new List <PhysicsPart>(1);

            var gfxObj = new Collision.GfxObj((GfxObj)DBObj.Get(new QualifiedDataID(6, gfxObjID)));

            if (gfxObj != null)
            {
                if (gfxObj.PhysicsSphere != null)
                {
                    setup.SortingSphere = gfxObj.PhysicsSphere;
                }
                else
                {
                    setup.SortingSphere = gfxObj.DrawingSphere;
                }
            }

            var part = new PhysicsPart();

            part.GfxObj = new List <Collision.GfxObj>()
            {
                gfxObj
            };
            setup.Parts.Add(part);

            var placementType = new PlacementType();

            //placementType.AnimFrame.NumParts = 1;
            setup.PlacementFrames.Add((int)gfxObjID, placementType);
            return(setup);
        }
Example #2
0
        public TransitionState FindObjCollisions(GfxObj gfxObj, Transition transition, float scaleZ)
        {
            var path = transition.SpherePath;

            foreach (var localSpaceSphere in path.LocalSpaceSphere)
            {
                var offset = PhysicsSphere.Center - localSpaceSphere.Center;
                var radsum = PhysicsSphere.Radius + localSpaceSphere.Radius;

                if (offset.LengthSquared() - radsum * radsum < PhysicsGlobals.EPSILON)
                {
                    if (path.InsertType == InsertType.InitialPlacement)
                    {
                        return(PhysicsBSP.placement_insert(transition));
                    }
                    else
                    {
                        return(PhysicsBSP.find_collisions(transition, scaleZ));
                    }
                }
            }
            return(TransitionState.OK);
        }
Example #3
0
 public static TransitionState FindObjCollisions(GfxObj gfxObj, Transition transition, float scaleZ)
 {
     return(TransitionState.OK);
 }