Top view game

Hi All,

I am new to box2d, I like it very much, it is a great engine, bla bla bla.

Currently I am working on a game project and at some point it was decided to reimplement all our movement logic using box2d.
I was trying to find few answers in ur internets, but unfortunatly there is not much detailed information, and official manual isn't that good 🙁

So if somebody can answer me those or give a clue I would be very gratefull.

First question: I am trying to make an object to follow mouse with linear velocity. As I understand right it can be done with mousejoint, but I couldn't find enough examples to do it.

Second: I wish to implement jump/teleport feature for the game. So for jumping in a top view game using box2d there is no many choises. I can't just make object ignore collisions for some range as it can land in some textures. So what I have in mind for now is calculate possible landing zone using our old collisions method outside of box2d and then set coordinates in box2d world. But this is kinda dirty solution and I would like to avoid it.

Ok, so thank u in advance for your help.
The manual contains pretty much everything you need to know, but if you wanted it to have a section for all kinds of game-specific issues I think you're expecting a bit much.

Making an object move with linear velocity to a position is simple:
Code:
b2Vec2 delta = desiredPosition - body->GetPosition();
float remainingDistance = delta.Normalize();
float distanceToMove = b2Min( maxMoveDistance, remainingDistance );
body->SetLinearVelocity( speedModifier * distanceToMove * delta )
That's a very simple approach, you might also want to try applying a force or impulse instead of setting the velocity explicitly.

I think teleporting is typically done with body->SetTransform() to get an instantaneous move effect. You could use QueryAABB to check if a given area has anything in it, to decide whether the player can teleport there.
Many thanks!

Original thread: https://box2d.org/forum/viewtopic.php?t=7465