Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Stop an applyLinearImpulse — Gideros Forum

Stop an applyLinearImpulse

DikkesnoekDikkesnoek Member
edited October 2012 in General questions
Hello,

I want to shoot an objects. I used the applyLinearImpulse. When I want to shoot
the object a second time (I did a removeChild and a addChild to this object) It
looks that it still has that impulse. The object is going faster and faster. Any
idea how I can fix or stop this?

Thanks,

Marc

Comments

  • Well, from physics point of view, you need to apply same force into opposite direction to stop the object :D Sorry couldn't help it :)

    So as I understand you want to reuse same body for shooting another object? I don't know if thats a good idea, but if you really want it, you can try setting velocity of body
    body:setLinearVelocity(0, 0)
    body:setAngularVelocity(0)
    thus making it to stop moving and then try shooting it again ;)

  • Thanks. I have a sprite with body. I shoot this one by tapping on the screen to
    different directions mostly horizontal. I use gravity too. I haven't added physics
    yet to to the other objects like floors and walls so at them moment the object
    is leaving the screen. When I tap the next time on the screen I want to do the
    same shooting action. By swiping on the screen I can give the object some angle
    (Angry Birds effect). Later I will add different velocities to influence the speed
    and the distance the object will get.

    Regards,

    Marc
  • Your example works great!

    Marc
Sign In or Register to comment.