Box2DX.Dynamics.Controllers.Controller.AddBody C# (CSharp) Method

AddBody() public method

Adds a body to the controller list.
public AddBody ( Body body ) : void
body Body
return void
        public void AddBody(Body body)
        {
            ControllerEdge edge = new ControllerEdge();

            edge.body = body;
            edge.controller = this;

            //Add edge to controller list
            edge.nextBody = _bodyList;
            edge.prevBody = null;
            if(_bodyList!=null)
                _bodyList.prevBody = edge;
            _bodyList = edge;
            ++_bodyCount;

            //Add edge to body list
            edge.nextController = body._controllerList;
            edge.prevController = null;
            if(body._controllerList!=null)
                body._controllerList.prevController = edge;
            body._controllerList = edge;
        }