code segment:
function tick()
local velocityIterations=8
local positionIterations=1
world:Step(0.01,velocityIterations,positionIterations)//Box2d API:b2Word
b=world:GetBodyList()//Box2d API:b2Word
while b~=nil do
if b:GetUserData()~=nil then
myActor=b:GetUserData();
debug.setmetatable(myActor,cocos2d.CCSprite)//myActor is userdate type,change myActor to CCSprite type
myActor:setPosition(cocos2d:CCPointMake(b:GetPosition().x * ptmratio,b:GetPosition().y*ptmratio))
myActor:setRotation(–1*b:GetAngle())
end
b=b:GetNext();
end
i change a variable from userdate to CCSprite using “debug.setmetatable”,the variable can’t call setPosition method,who know this? Please help me!