{"action":"closed","issue":{"url":"https://api.github.com/repos/deltaluca/nape/issues/76","labels_url":"https://api.github.com/repos/deltaluca/nape/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/deltaluca/nape/issues/76/comments","events_url":"https://api.github.com/repos/deltaluca/nape/issues/76/events","html_url":"https://github.com/deltaluca/nape/issues/76","id":23474170,"number":76,"title":"Changing Shapes of Body results in Tunneling","user":{"login":"IAmJulianAcosta","id":1844640,"avatar_url":"https://avatars.githubusercontent.com/u/1844640?v=3","gravatar_id":"","url":"https://api.github.com/users/IAmJulianAcosta","html_url":"https://github.com/IAmJulianAcosta","followers_url":"https://api.github.com/users/IAmJulianAcosta/followers","following_url":"https://api.github.com/users/IAmJulianAcosta/following{/other_user}","gists_url":"https://api.github.com/users/IAmJulianAcosta/gists{/gist_id}","starred_url":"https://api.github.com/users/IAmJulianAcosta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IAmJulianAcosta/subscriptions","organizations_url":"https://api.github.com/users/IAmJulianAcosta/orgs","repos_url":"https://api.github.com/users/IAmJulianAcosta/repos","events_url":"https://api.github.com/users/IAmJulianAcosta/events{/privacy}","received_events_url":"https://api.github.com/users/IAmJulianAcosta/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-11-29T03:44:54Z","updated_at":"2015-06-07T09:47:31Z","closed_at":"2015-06-07T09:47:31Z","body":"Hi, I'm using nape width AIRKinect (http://www.as3nui.com/air-kinect/), and I'm trying to generate a Body from the image generated from kinect (which I've done succesfully). \r\n\r\nI'm trying to make a game when people have to collect items over their arms, but I'm having tunneling problems, when the person raises an arm very fast, some of the objects fall. \r\n\r\nI tried the following:\r\n- Clearing the shapes of the object and adding new ones\r\n- Replacing the body with a new (generated) one.\r\n\r\nI used this example: BodyFromGraphic\r\n\r\nHere is a sample code (without using kinect, just using a generated shape to illustrate the problem):\r\n```ActionScript\r\npackage {\r\n\t//////////////FLASH.DISPLAY/////////////\r\n\timport flash.display.DisplayObject;\r\n\timport flash.display.Sprite;\r\n\timport flash.display.StageQuality;\r\n\timport flash.display.MovieClip;\r\n\timport flash.display.Bitmap;\r\n\timport flash.display.Stage;\r\n\timport flash.display.StageAlign;\r\n\timport flash.display.StageScaleMode;\r\n\timport flash.display.Shape;\r\n\timport flash.display.Graphics;\r\n\timport flash.display.IGraphicsData;\r\n\timport flash.display.GraphicsPath;\r\n\timport flash.display.GraphicsStroke;\r\n\timport flash.display.CapsStyle;\r\n\t//////////////TEXTO EN PANTALLA/////////////\r\n\timport flash.text.TextField;\r\n\timport flash.system.System;\r\n\timport flash.utils.getTimer;\r\n\t//////////////FLASH.EVENTS/////////////\r\n\timport flash.events.MouseEvent;\r\n\timport flash.events.Event;\r\n\timport flash.events.TimerEvent;\r\n\t//////////////UTILS/////////////\r\n\timport flash.utils.Timer;\r\n\t//////////////NAPE/////////////\r\n\timport nape.geom.Vec2;\r\n\timport nape.phys.Body;\r\n\timport nape.phys.BodyType;\r\n\timport nape.geom.AABB;\r\n\timport nape.geom.GeomPoly;\r\n\timport nape.geom.GeomPolyList;\r\n\timport nape.geom.IsoFunction;\r\n\timport nape.geom.MarchingSquares;\r\n\timport nape.phys.Body;\r\n\timport nape.shape.Circle;\r\n\timport nape.shape.Polygon;\r\n\timport Template;\r\n\timport IsoBody;\r\n\timport DisplayObjectIso;\r\n\timport nape.shape.Shape;\r\n\r\n\tpublic class NapeReplaceShapes extends Template {\r\n\t\tprivate var bmp:Bitmap;\r\n\t\tprivate var skeletonContainer:Sprite;\r\n\t\tprivate var bones:Shape;\r\n\t\tprivate var boneSet:Boolean;\r\n\t\tprivate var bonesIso:DisplayObjectIso;\r\n\t\tprivate var bonesBody:Body;\r\n\t\tprivate var timer:Timer;\r\n\t\tpublic var frameRate:TextField;\r\n\t\tpublic var memory:TextField;\r\n\t\tprivate var frames = 0;\r\n\t\tpublic var curTimer:Number;\r\n\t\tpublic var prevTimer:Number;\r\n\t\tvar xx:Number = 0;\r\n\t\tvar yy: Number = 350;\r\n\t\tvar xxx:Number = 600;\r\n\t\tvar yyy:Number = 350;\r\n\t\tvar frameNumber:int = 0;\r\n\r\n\t\tpublic function NapeReplaceShapes () {\r\n\t\t\tsuper ({\r\n\t\t\t   gravity : Vec2.get(0, 500),\r\n\t\t\tnoReset : true,\r\n\t\t\tshapeDebug : false\r\n\t\t\t});\r\n\t\t\tstage.align = StageAlign.TOP_LEFT;\r\n\t\t\tstage.scaleMode = StageScaleMode.NO_SCALE;\r\n\t\t\tbones = new Shape();\r\n\t\t\t\r\n\t\t\taddChild (bones);\r\n\r\n\t\t\ttimer = new Timer(30,0);\r\n\t\t\ttimer.addEventListener (TimerEvent.TIMER, crearObjetoConTiempo);\r\n\t\t\ttimer.start ();\r\n\t\t\t\r\n\t\t\taddEventListener (Event.ENTER_FRAME, update);\r\n\t\t}\r\n\r\n\t\tprotected function update (e:Event):void {\r\n\t\t\tif (contains(bones)) {\r\n\t\t\t\tremoveChild (bones);\r\n\t\t\t}\r\n\t\t\tbones = new Shape ();\r\n\t\t\tbones.x = 0;\r\n\t\t\tbones.y = 0;\r\n\t\t\tframeNumber++;\r\n\t\t\ttrace (frameNumber);\r\n\t\t\tif (yy > 000 && frameNumber > 10) {\r\n\t\t\t\tyy-=20;\r\n\t\t\t\tyyy-=20;\r\n\t\t\t}\r\n\r\n\t\t\t/////////////////////////TEST///////////////////////////\r\n\t\t\tbones.graphics.lineStyle (10, 0x00CCFF, 1, true, \"normal\", \"ROUND\");\r\n\t\t\tbones.graphics.moveTo (0, 0);\r\n\t\t\tbones.graphics.lineTo (xx, yy);\r\n\t\t\tbones.graphics.moveTo (xx, yy);\r\n\t\t\tbones.graphics.lineTo (xxx, yyy);\r\n\t\t\t\r\n\t\t\tbonesIso = new DisplayObjectIso(bones);\r\n\t\t\taddChild (bonesIso.displayObject);\r\n\t\t\tif (bonesBody == null) {\r\n\t\t\t\tbonesBody = IsoBody.run(bonesIso,bonesIso.bounds);\r\n\t\t\t\tbonesBody.type = BodyType.KINEMATIC;\r\n\t\t\t\tspace.bodies.add (bonesBody);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tbonesBody.shapes.clear();\r\n\t\t\t\tvar calculationBody:Body = IsoBody.run(bonesIso,bonesIso.bounds);\r\n\t\t\t\tfor (var i:int = 0; i < calculationBody.shapes.length; i++) {\r\n\t\t\t\t\tbonesBody.shapes.add (calculationBody.shapes.at(i).copy());\r\n\t\t\t\t}\r\n\t\t\t\tcalculationBody = null;\r\n\t\t\t}\r\n\t\t\tremoveChild (bonesIso.displayObject);\r\n\t\t\tbonesIso = null;\r\n\t\t\tvar x1:int = bones.getBounds(bones).x;\r\n\t\t\tvar w:int = bones.getBounds(bones).width;\r\n\t\t\tvar x2:int = x1 + w;\r\n\t\t\tvar px = (x1 + x2) / 2;\r\n\t\t\tvar y1:int = bones.getBounds(bones).y;\r\n\t\t\tvar h:int = bones.getBounds(bones).height;\r\n\t\t\tvar y2:int = y1 + h;\r\n\t\t\tvar py = (y1 + y2) / 2;\r\n\t\t\tbonesBody.position.setxy (px, py);\r\n\t\t\tvar deltaX:Number = bonesBody.bounds.x - x1;\r\n\t\t\tvar deltaY:Number = bonesBody.bounds.y - y1;\r\n\r\n\t\t\tbonesBody.position.setxy (px-deltaX, py-deltaY);\r\n\r\n\t\t\t//addChild (bones);\r\n\r\n\t\t}\r\n\r\n\t\tprivate function crearObjetoConTiempo (evento:TimerEvent):void {\r\n\t\t\tgenerateObject (new Vec2 (Math.random () * width,0));\r\n\t\t\t\r\n\t\t}\r\n\r\n\t\tprivate function generateObject (pos:Vec2):void {\r\n\t\t\tvar body:Body = new Body(BodyType.DYNAMIC);\r\n\t\t\tbody.position = pos;\r\n\r\n\t\t\t// Add random one of either a Circle, Box or Pentagon.\r\n\t\t\tif (Math.random() < 0.33) {\r\n\t\t\t\tbody.shapes.add (new Circle(10));\r\n\t\t\t}\r\n\t\t\telse if (Math.random() < 0.66) {\r\n\t\t\t\tbody.shapes.add (new Polygon(Polygon.box(10, 10)));\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tbody.shapes.add (new Polygon(Polygon.regular(10, 10, 5)));\r\n\t\t\t}\r\n\t\t\tspace.bodies.add (body);\r\n\t\t}\r\n\r\n\t\toverride protected function init ():void {\r\n\t\t\tvar w:uint = stage.stageWidth / 2;\r\n\t\t\tvar h:uint = stage.stageHeight / 2;\r\n\t\t\tcreateBorder ();\r\n\t\t}\r\n\r\n\t\toverride protected function postUpdate (deltaTime:Number):void {\r\n\t\t\tfor (var i:int = 0; i < space.liveBodies.length; i++) {\r\n\t\t\t\tvar body:Body = space.liveBodies.at(i);\r\n\t\t\t\tvar graphic:DisplayObject = body.userData.graphic;\r\n\t\t\t\tif (graphic == null) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar graphicOffset:Vec2 = body.userData.graphicOffset;\r\n\t\t\t\tvar position:Vec2 = body.localPointToWorld(graphicOffset);\r\n\t\t\t\tgraphic.x = position.x;\r\n\t\t\t\tgraphic.y = position.y;\r\n\t\t\t\tgraphic.rotation = (body.rotation * 180/Math.PI) % 360;\r\n\t\t\t\tposition.dispose ();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nAm I doing anything wrong? \r\nThanks.\r\n"}}