I'm trying to make the game, using LibGDX. I create a Model from *g3db file like this:
public AssetManager assets;
assets = new AssetManager();
assets.load("data/road.g3db", Model.class);
Model road = assets.get("data/road.g3db", Model.class);
ModelInstance roadInstance = new ModelInstance(road);
data/road.g3db is a а long ribbon like road. I make its in blender 3d. Somthing like this:
****
* ***** ****
* * *
*** *******
My question is: how can i create body from this Model? I try this:
ChainShape shape = new ChainShape();
Mesh roadMesh = roadInstance.model.meshes.get(0);
float ar[] = new float[roadMesh.getVerticesBuffer().capacity()];
roadMesh.getVerticesBuffer().get(ar);
shape.createChain(ar);
But there are error:
AL lib: (EE) alc_cleanup: 1 device not closed
Assertion failed!
Program: C:\Program Files (x86)\Java\jre7\bin\javaw.exe
File: /var/lib/jenkins/workspace/libgdx/gdx/jni/Box2D/Collision/Shapes/b2ChainShape.cpp,
Line 63
Expression: b2DistanceSquared(v1, v2) > 0.005f * 0.005f
Is there another way to create body for long road ?
Box2Dis a 2D physics engine. If you need your physics only in 2d then you have to create a body somehow but not with theModel, causeModelis 3D. - Robert P