Tag Info

Hot answers tagged

3

Simple Solution If you want the body to instantly rotate just call Body::setTransform and pass the current position and the desired angle, don't bother applying torques or anything. The function call could be something like this: body.setTransform(body.getPosition(),myDesiredAngle); Physics Solution If you want the player body to interact with bodies ...


2

NauticalMile's answer is great (and bonus points for the killer animated diagrams). To give an alternate suggestion that doesn't suffer from the same problems (the wheel collision stopping you from moving past objects that a floating body should be able to traverse effortlessly, I suggest modelling something more closely matched to the reality of your ...


1

First, when are you calling the jump() method? Make sure it really gets called, maybe by using a log message. Second, instead of body.setLinearVelocity(new Vector2(body.getLinearVelocity().x, 12)); you should do body.setApplyForce(new Vector2(0, 120)); Setting a velocity directly is frowned upon and should be done only in a few exceptional cases such ...


1

Bodies are made up of one or more fixtures and fixtures define a shape. This means, for each fixture, you need to get the shape and its size, then combine those to get the total width and height. It looks like the easiest way is with getRadius(), but that doesn't give you much. You may want to get the shape type, then create methods for getting more detailed ...



Only top voted, non community-wiki answers of a minimum length are eligible