Hi guys,
Say I have a world with no gravity and have a body, that I want to move in a direction it is facing.
So far I used
local ang = body:getAngle()
local x, y = body:getPosition()
x = x - math.sin(ang)*speed
y = y + math.cos(ang)*speed
body:setPosition(x,y)
on every frame. Yet it appears that setPosition is not the best solution when it bumps into other objects, it tries to go through them and look rather unnatural.
Please suggest, what method should I use to move this body? some applyForce or something?
Thanks
Comments
Likes: RogerT
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
I think using impulses or applyForce works best and seems more real.
Below is something I use with TNTpad
Likes: RogerT
)
Likes: Scouser, ar2rsawseen, hgvyas123, gmarinov
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@techdojo don't worry, if I had to move a body, I'd do it your way!
Likes: chipster123