Best way to color a Box2d body using LibGDX -


I have just started playing with very simple games and I do not want to create a prehistoric picture for every body, I just need to.

According to this thread, the shape Rander is not a very good idea and it is more for development:

In addition, tint can be used only For those who also need images on the texture:

It is a body that I try to paint I:

  // dynamic body Bodeedaf = new Bodeedif (); //bodyDef.gravityScale bodyDef.type = BodyType.DynamicBody; bodyDef.position.set (camera.viewportWidth / 2, camera.details, highlight / 2); Body = world.createBody (bodyDef); CircleShape dynamicCircle = new CircleShape (); dynamicCircle.setRadius (10f); Stability Def Stability = New Stability Def (); FixtureDef.shape = dynamic cycle; Stability Def Density = 2.5 F; Stability Def.France = 0.25F; Sustainability Def Beautification = 0.75f; Body.createFixture (fixtureDef);   

Any ideas?

But instead of scene2d and its actor, Libgdix Wiki already describes completely How to do this.

You can create a class that extends the actor (or group) and that outlines the design you want.

Bodies, you can set the user's data to the actor through the setUserData (Actor);

Now after simulating the box 2d world with the box, you just need to iterate the bodies in the world, the actor through getUserData () Reach and update the actor's status and rotatin to the existing values ​​of the body. The wiki already has the entire loop required for it ...

Hope this is ... ...)

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -