It looks like you're new here. If you want to get involved, click one of these buttons!
function b2.World:changeBodyState(object, config) -- remove this condition if you want change terrain body too -- if object.body._conf.shape == "circle" or object.body._conf.shape=="rectangle" then local conf = { type = "static", draggable = false, } if config then --copying configuration for key,value in pairs(config) do conf[key]= value end end local setType = b2.STATIC_BODY if conf.type == "dynamic" then setType = b2.DYNAMIC_BODY elseif conf.type == "kinematic" then setType = b2.KINEMATIC_BODY end --[[ -------------------------- Update Script Oct-14-2014 -------------------------- Prevent bug when you change "conf.draggable" many times to "true" for more information see: <a href="http://giderosmobile.com/forum/discussion/4668/change-body-properties#Item_2" rel="nofollow">http://giderosmobile.com/forum/discussion/4668/change-body-properties#Item_2</a> ]] -- update body type self.sprites[object.id].body:setType(setType) object.body._conf.type = conf.type -- update draggable -- bug when both object.body._conf.draggable and -- conf.draggable are true if object.body._conf.draggable ~= conf.draggable then object.body._conf.draggable = conf.draggable if conf.draggable then self:makeDraggable(object) else if object.onDragStart then self:undoDraggable(object) end end end --else -- Do you want terrain dynamic or kinematic or draggable? --print(object.body._conf.shape) --end end |
Likes: talis
Comments
I found bug in previous script
For example:
Cheers
Likes: talis
[-] Liasoft