I am new user of JPCT-AE. It may be silly question, but I tried too much I am not getting any such result.
My problem is, I have a car object which having 7-8 mess or 30-40 array of Object3D but the file is single and the format is car.3ds. I have loaded the car and displaying in the screen, when the user will pick any part of the car(i.e. tire, light, body etc.) only that part or mesh should be identified. I have tried but I am not getting whole car. Please suggest me how can I get identify individual parts or mess/part of the car. I have attached the code for your verification, whatever way I tried.
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (buffer != null) {
buffer.dispose();
}
buffer = new FrameBuffer(gl, w, h);
// if (master == null)
{
world = new World();
world.setAmbientLight(150, 150, 150);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
int rID = R.raw.car;
try {
model = Object3D.mergeAll(loadModel(rID, modelScale)); } catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
model.build();
world.addObject(model);
cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(model.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(model.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
if(bInitObjectPos){
initObjectSetting();
bInitObjectPos = false;
}
}
}
private SimpleVector getWorldPosition(float X, float Y)
{
SimpleVector pos = null;
model.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS|Object3D.COLLISION_CHECK_SELF);
model.setCollisionOptimization(true);
SimpleVector ray = Interact2D.reproject2D3DWS(world.getCamera(),
buffer, (int) X, (int) Y);
if (ray != null) {
SimpleVector norm = ray.normalize();
Object[] slectedModel = world.calcMinDistanceAndObject3D(world.getCamera().getPosition(), norm, 1000);
if (slectedModel[1] != null) {
Object3D selectmodel = (Object3D)slectedModel[1]; }
}
return pos;
}
Here I am getting selectmodel is same as model, but I need individual parts of the same object. model consists array of Object3D, I need by touch whatever parts selected then that should return as selectmodel. Is there any API available in JPCT-AE. please share me your suggestion/opinion.