setLinearVelocity ?

how can I remove a setLinearVelocity from my view?
because when i change my scene, I get a error from setLinearVelocity “( a nil value )” and i dont use this think you my other scene

anyone know?
thanks [import]uid: 23063 topic_id: 11236 reply_id: 311236[/import]

fase1.lua:503: attempt to call method 'setLinearVelocity' (a nil value) Runtime script error at file fase1.lua line 503
this is my error and this is my code line:

local acao\_tartaruga = function(e) if jogoAtivado == true then myAnim:setLinearVelocity( 100, 0 ) end end

i get this error when I try to back to menu after winning the game [import]uid: 23063 topic_id: 11236 reply_id: 41066[/import]

What happens to myAnim when you go back to the menu? [import]uid: 58455 topic_id: 11236 reply_id: 41067[/import]

I encountered the same problem.

Make sure you have added your object to physics (e.g. call physics.addBody) first
before calling setLinearVelocity.

[import]uid: 67377 topic_id: 11236 reply_id: 42997[/import]

Has this question been resolved? I am having the same issue.
[EDIT] In my case, I was having an issue going back and forth from one scene back to the other, and I resolved it by removing the object between scenes… does that make sense? [import]uid: 129334 topic_id: 11236 reply_id: 97611[/import]

My code is seperately running well. Bt using director when i am adding that code then its showning the setLinearVelocity error anybody can help me then i can show you my code etc ???

Most likely the cause is that your “myAnim” object has not had it’s physics body added when you re-entered the scene.  But all we can do is guess without seeing your code.

Rob

My code is seperately running well. Bt using director when i am adding that code then its showning the setLinearVelocity error anybody can help me then i can show you my code etc ???

Most likely the cause is that your “myAnim” object has not had it’s physics body added when you re-entered the scene.  But all we can do is guess without seeing your code.

Rob