1
Support / Need to collide two md2 (animated character)
« on: October 28, 2010, 05:43:44 pm »
Hi All,
I am loading two md2 (in serialize form) file using Loader.loadSerializedObject(A) and Loader.loadSerializedObject(B) in side onSurfaceCreated. A and B both are animated (like Ninja they Jump, Kick) and using animate to animate these two charcter. I want to collide both there Animated Character and want to show some change in color kind of blood when they both collide. Please let me know if anyone know the solution and please tell me the steps how can I achieve this collision between these two animated characters. I will give him some reward if he/she can help me to get out of this problem or find some solution.
Inside public void onSurfaceCreated(GL10 gl, EGLConfig config) I am trying with following method but it’s not working . I am not able to find any Collision and CollisionListener is not working.
A.animate (counter, animationSequenceCounter)
B.animate (counter, animationSequenceCounter)
A.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
A.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
B.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
B.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
A.addCollisionListener(new CollisionListener()
{
@Override
public boolean requiresPolygonIDs()
{
return true;
}
@Override
public void collision(CollisionEvent e)
{
if (e.getType()==CollisionEvent.TYPE_TARGET && e.getSource()!=null)
{
destroy();
}
}
});
B.addCollisionListener(new CollisionListener()
{
@Override
public boolean requiresPolygonIDs()
{
return true;
}
@Override
public void collision(CollisionEvent e)
{
if (e.getType()==CollisionEvent.TYPE_TARGET && e.getSource()!=null)
{
destroy();
}
}
});
Thanks & Regards,
GKapoor
I am loading two md2 (in serialize form) file using Loader.loadSerializedObject(A) and Loader.loadSerializedObject(B) in side onSurfaceCreated. A and B both are animated (like Ninja they Jump, Kick) and using animate to animate these two charcter. I want to collide both there Animated Character and want to show some change in color kind of blood when they both collide. Please let me know if anyone know the solution and please tell me the steps how can I achieve this collision between these two animated characters. I will give him some reward if he/she can help me to get out of this problem or find some solution.
Inside public void onSurfaceCreated(GL10 gl, EGLConfig config) I am trying with following method but it’s not working . I am not able to find any Collision and CollisionListener is not working.
A.animate (counter, animationSequenceCounter)
B.animate (counter, animationSequenceCounter)
A.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
A.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
B.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
B.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
A.addCollisionListener(new CollisionListener()
{
@Override
public boolean requiresPolygonIDs()
{
return true;
}
@Override
public void collision(CollisionEvent e)
{
if (e.getType()==CollisionEvent.TYPE_TARGET && e.getSource()!=null)
{
destroy();
}
}
});
B.addCollisionListener(new CollisionListener()
{
@Override
public boolean requiresPolygonIDs()
{
return true;
}
@Override
public void collision(CollisionEvent e)
{
if (e.getType()==CollisionEvent.TYPE_TARGET && e.getSource()!=null)
{
destroy();
}
}
});
Thanks & Regards,
GKapoor