Bones - Skeletal and Pose Animations for jPCT/jPCT-AE > Bones
collision with Bones
subhalakshmi27:
Hi All,
In normal 3D object in World space, following collision detection code worked.
sphere.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
sphere.addCollisionListener(new CollisionListener() {
@Override
public boolean requiresPolygonIDs() {
// TODO Auto-generated method stub
return false;
}
@Override
public void collision(CollisionEvent arg0) {
Log.i("HelloWorldJPCT", "Sphere collision");
}
});
When I tried the collision detection in Bones sample code , I never got any log message, Following is the code
ninjas.get(0).get(0).setCollisionMode(Object3D.COLLISION_CHECK_SELF);
ninjas.get(0).get(0).addCollisionListener(new CollisionListener() {
@Override
public boolean requiresPolygonIDs() {
// TODO Auto-generated method stub
return false;
}
@Override
public void collision(CollisionEvent ce) {
// TODO Auto-generated method stub
Log.i("app", "On collision");
}
});
Please let me know if I am missing something.
Regards,
Subha
raft:
Bones does not do/change anything aboout collision detection. To be sure, I did a quick test by modifying collsion detection sample in wiki. added the lines below. collision detection worked and collision events are generated.
I'm not sure what's wrong with your sample. maybe it's the scaling of objects?
--- Code: --- cube = BonesIO.loadGroup(new FileInputStream("ninja.group.bones")).get(0);
cube.scale(1f/10);
cube.translate(-50, -300, -50);
cube.addCollisionListener(new CollisionListener() {
@Override
public boolean requiresPolygonIDs() {
return false;
}
@Override
public void collision(CollisionEvent ce) {
System.out.println("collision");
}
});
--- End code ---
subhalakshmi27:
Hi Raft,
Sorry I forgot to mention this before, I am checking collision with bones in Android (JPCT-AE). I will check again what you have mentioned. Does Android engine can have an impact in Collision detection with bones ::)?
Regards,
Subha
raft:
no, I don't think so
subhalakshmi27:
Hi Raft,
I tried again, but no luck. I am attaching the source code.
Previously in JPCT-AE forum, when the collision didn't work, One suggestion was given to make the screen as full screen. I did the same in this project also.
<activity
android:label="@string/app_name"
android:name=".BlendprojectActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Do I need to post the question in JPCT-AE forum also ? I need the collision as I am trying to detect if the user has touched any specific area in animation. :(
Thanks in Advance.
Regards,
Subha
[attachment deleted by admin]
Navigation
[0] Message Index
[#] Next page
Go to full version