AleksandarMIlenkovic / quickb2

Automatically exported from code.google.com/p/quickb2
0 stars 0 forks source link

never sleep? #29

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I found qb2Body never sleep!
CPU has always maintained in a higher level.
My question in out?

Original issue reported on code.google.com by cjpxyz2...@gmail.com on 13 Jul 2011 at 8:29

GoogleCodeExporter commented 8 years ago
What version are you using?  It could be possible that graphics are to blame 
for higher CPU...are you separating graphics in your benchmark somehow?

Original comment by doug...@gmail.com on 23 Jul 2011 at 7:06

GoogleCodeExporter commented 8 years ago
Thank you for your reply!
I am using version QuickB2 0.6 Beta.
I test HelloWorld project in the examples folder.
Minor modifications
package 
{
    import As3Math.geo2d.*;
    import flash.display.*;
    import flash.events.Event;
    import QuickB2.objects.qb2Object;
    import QuickB2.objects.tangibles.*;
    import QuickB2.stock.*;

    /** Really simple example that pulls in the precompiled QuickB2.swc.
     * 
     * @author Doug Koellmer
     */
    public class Main extends Sprite 
    {
        private var _world:qb2World;
        public function Main():void 
        {
            var world:qb2World = qb2Stock.newDebugWorld(new amVector2d(0, 10), this.graphics, stage);
            _world = world;
            world.start();
            var walls:qb2StageWalls = new qb2StageWalls(stage);
            world.addObject(walls);
            for (var i:uint = 0; i < 60; i++) {
                var w:Number = 15 + Math.random() * 15;
                var h:Number = 15 + Math.random() * 15;
                var dx:Number = w * 0.5 + (stage.stageWidth - w)*Math.random();
                var dy:Number = h * 0.5 + (stage.stageWidth - h)*Math.random();
                var shape:qb2Body = qb2Stock.newRectBody(new amPoint2d(), w, h, w * h);
                    shape.position.set(dx, dy);
                world.addObject(shape);
            }
            addEventListener(Event.ENTER_FRAME, updateHandler);
        }

        private function updateHandler(e:Event):void 
        {
            for (var i:uint = 0; i < _world.numObjects; i++) {
                var object:qb2Object = _world.getObjectAt(i);
                if (object is qb2Body) {
                    if (qb2Body(object).isSleeping) {
                        trace(object + ": isSleeping");
                    }
                }
            }
        }
    }
}
About 60 qb2body,maintained at about 20% cpu.
Does not contain any other.
I think if the qb2body is sleeping, cpu should be 0,And the output"qb2body 
isSpling".Right?
Another error
i use FlashDevelop and Adobe® Flex® 4 SDK
Test Movie Output the following results
Access of undefined property qb2_error.
What is the reason?

Original comment by cjpxyz2...@gmail.com on 4 Aug 2011 at 8:04

GoogleCodeExporter commented 8 years ago
I would try first to update to latest SVN changes and see if anything changes.  
For now, use source code also, not the .swc.  There are problems with the .swc.

Original comment by doug...@gmail.com on 10 Aug 2011 at 4:57