简体   繁体   中英

Rendering Box2D Chain Shape in libgdx

I'm using the chain shape as the walls for a 2D race track. Everything works perfectly with the Debug Renderer, and I'm able to render other objects simply with sprites.

But how do I render the chain shape (without using the debug renderer)? I see nothing about this in the documentation.

I'm using RUBE to create the track, so the chain shapes are not really a part of the libgdx code. This is what the full map looks like in RUBE: It's just 2 chain shapes with many vertices

I use libgdx to load the Json file created by RUBE (which loads the chain shapes), then I spawn the player within the 2 chain shapes.

Any advice is welcome.

EDIT: The best solution I can think of is to collect the vertices of the chain shape, and use those to draw a line with no relation to the actual chain shape. However, this seems more like a workaround, and I feel like there's an easier/more direct way to display chain shapes.

For anybody else running into the same issue: it seems to be the case that there isn't really a way to render chain shapes. The solution to my problem is to render an image of the track, then create the chain shapes on the boundaries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM