How would you go about this? I can set the kinematic body to move at a constant speed, but I was wondering if anybody had some tips for actually "tweening" a kinematic body instead of just moving it. Ideas?
Tweening a kinematic body from point a to b?
General DiscussionYou'll have to gradually increase and decrease the linear velocity to do tweening.
Ah thanks! yea I tried to figure out some logic for that during my game loop, but I found another way using jquery (I'm using the box2dweb version)
I assume this method will work with any tween engine, you just need to use the step/onUpdate functionality like so:
$(currentPosition).animate({x: endPos.x/scale, y: endPos.y/scale}, {step: function() {
body.SetPosition(currentPosition);
}, duration: speed});
I assume this method will work with any tween engine, you just need to use the step/onUpdate functionality like so:
$(currentPosition).animate({x: endPos.x/scale, y: endPos.y/scale}, {step: function() {
body.SetPosition(currentPosition);
}, duration: speed});
Original thread: https://box2d.org/forum/viewtopic.php?t=8237