Is possible to “impose” ghosts on an already existing collision shapes like a ragdoll bone i.e. simply have the bone inherit the traits of a ghost…I need to know when two Kinematic mode ragdoll bones make contact…
Sure, just attach both controls to one spatial.
@normen said:
And by the way, all your collision code seems to base on the user object, I think that is used somehow else for the rag doll, maybe thats where the event gets dropped.
that what I'm thinking too, but I can't figure on where or how to start looking ..............if I slide one instance of sinbad into another there is a reaction that cause a stutter and fps dropped I,m guess or hoping its collisions causing that, the collision method in KinematicRagdollControl discards low impulse collisions and the ragdoll collisions.......... it also seems to be pendant on the inner class PhysicsBoneLink but users dont have access to that save for maybe copying and customizing KinematicRagdollControl but as far a I can tell the ragdoll listener doesn't seem able to output data for recognizing ragdoll on ragdoll contact even in ragdoll mode.
@normen said:
Sure, just attach both controls to one spatial.
Could you explain further.because I did that, sort of, before I posted and its working somewhat, the shape is not oriented to the bone though, in fact it seems a new collision shape is created ............................should extend kinetic ragdoll to add ghosts or can I get it looking right without messing with the jme classes
this is what I did as a small test
I attached the ghost to an attachment node created with the particular bone
[java] SkeletonControl skeletonControl = model2.getControl(SkeletonControl.class);
Node g1 = skeletonControl.getAttachmentsNode("Foot.L");
CollisionShape myShape = ragdoll2.getBoneRigidBody("Foot.L").getCollisionShape();
ghostControl = new GhostControl(myShape);
g1.addControl(ghostControl);
getPhysicsSpace().add(ghostControl);[/java]
and then I setup the ragdoll collisions to listen for node collisions which works except for the orientation issues and duplication of the collision shapes
[java] public void collide(Bone bone, PhysicsCollisionObject object, PhysicsCollisionEvent event) {
if (object.getUserObject() != null && (object.getUserObject() instanceof Node)) {
Node geom = (Node) object.getUserObject();
if ("Floor".equals(geom.getName())) {
return;
}
if(animControl.getSkeleton().getBoneIndex(bone) == -1) return;
System.out.println("ragdoll1 "+bone.getName() +" "+ object.getUserObject().toString());
//ragdoll2.setRagdollMode();
}[/java]
now I have been trying to do this via the ragdoll listeners with "bones on collision shapes" but with no success, although, Nehon said it was possible the above code has been the only attempt to send updates to the console
thanks in advance for any help
Why you want to use it for the single bones? They are already rigidbodies.
I want to apply animations based on which body part is contacted during fights like kick to the chest should yield a different reaction than a kick to the stomach or if arms contact treated it as a defensive block and play an appropriate animations and I didn’t want to to use ghosts but I am simple not getting any feedback (read messages )from the console when the ragdoll rigidbodys make contact with each other and I tried to configure the listener in so many different ways
this below is one out of several attempts that got no result, this being the most awkward attempt, I just don’t know what the missing link is and I have searched for it
[java] public void collide(Bone bone, PhysicsCollisionObject object,
PhysicsCollisionEvent event) {
if(animControl.getSkeleton().getBoneIndex(bone) == -1) return;
if(animControl2.getSkeleton().getBoneIndex(bone) == -1) return;
if (object.getUserObject() instanceof CollisionShape && (object.getUserObject() == (CollisionShape) ragdoll.getBoneRigidBody(bone.getName()).getCollisionShape() && object.getUserObject() == (CollisionShape) ragdoll2.getBoneRigidBody(bone.getName()).getCollisionShape()) ) {
//PhysicsRigidBody prb = (PhysicsRigidBody) object.getUserObject();
if (ragdoll.getBoneRigidBody(bone.getName()).getCollisionShape().toString().equals(event.getNodeA().toString()) || ragdoll.getBoneRigidBody(bone.getName()).getCollisionShape().toString().equals(event.getNodeB().toString())) {
System.out.println(“yeah”);
System.out.println(“ragdoll1”+bone.getName() +" “+ object.getUserObject().toString());
if (ragdoll2.getBoneRigidBody(bone.getName()).getCollisionShape().toString().equals(event.getNodeA().toString()) || ragdoll2.getBoneRigidBody(bone.getName()).getCollisionShape().toString().equals(event.getNodeB().toString())) {
fpsText.setText(“You hit the box!”);
System.out.println(“yeah”);
System.out.println(“ragdoll2”+bone.getName() +” “+ object.getUserObject().toString());
}
//System.out.println(“yeah”);
//System.out.println(“ragdoll1”+bone.getName() +” "+ object.getUserObject().toString());
else
System.out.println(“No”);
}[/java]
… the basic rag doll test uses collision to make the rag doll fall, check into how it does it and if necessary also take a look at the classes inside jme3 doing that.
@normen said:
.. the basic rag doll test uses collision to make the rag doll fall, check into how it does it and if necessary also take a look at the classes inside jme3 doing that.
um I did that over and over
I tried Collision shape on the advice of Nehon no less .....no luck
that is how u get the collision for the bone rigidbody right....
[java]ragdoll.getBoneRigidBody(bone.getName()).getCollisionShape()[/java]
that was after simple trying the rigid bodies
so u have:
ragdoll bone on Spatial, Node, Geometry = output
ragdoll bone on Ragdoll bone, rigid body, collision shape...even went as far as using Physics Object, defining the collision event != output
............Is a possible why to that question such a big ask, I am not asking for code or for advanced character physics here just a simple way to let my app know that ragdoll_A hand has contacted Ragdoll_B chest, head, mouth, nose, dick.................. or preferable as stated a simple why Collision shape, rigidbody might not be the correct physics object data to yield the wanted result
now I did do research found this thread..........could be that what looking for is being suppressed, discarded, or is plain inaccessible at the moment ...I am use two instances of Sinbad, but what thetoucher suggested in that thread seems to successfully help define both ragdolls as seperate and unrelated
again all I am asking for are possible "why/s" and "maybe/s" especially since u seem to suggest that attachment node as ghosts.....which has been the only solution to yield the desired result is not a good move
Again, its all happening already. All parts are rigidbodies and collide regularly, I don’t know what your problem is.
What what I found previously on through the bulletphysics forum (the native bullet system jme uses and what the java physics system is based on), I think ghosts are only axis aligned. I don’t think they rortate with the spatial.
@normen said:
Again, its all happening already. All parts are rigidbodies and collide regularly
yes I know that............just cant get the ragdoll rigidbody on ragdoll rigidbody contacts "reported and filed" like ragdoll on Spatial get happily "reported and filed" for all the world to see, that's all ........hell I even tried !(instanceof Spatial) if
I mean code:
this works Geometry, Node, Spatial
[java]public void collide(Bone bone, PhysicsCollisionObject object, PhysicsCollisionEvent event) {
if (object.getUserObject() != null && (object.getUserObject() instanceof Geometry)) {
Node geom = (Geometry) object.getUserObject();
if ("Floor".equals(geom.getName())) {
return;
}
if(animControl.getSkeleton().getBoneIndex(bone) == -1) return;
System.out.println("ragdoll1 "+bone.getName() +" "+ object.getUserObject().toString()); //<
sends messages to console
//ragdoll2.setRagdollMode();
}[/java]
output from geoms
ragdoll1 Foot.R Box (Geometry)
ragdoll1 Foot.R Box (Geometry)
output from Nodes(remember I made the an attachment node from one of the feet as a test
ragdoll1 Foot.R Foot.L_attachnode (Node)
ragdoll1 Calf.R Foot.L_attachnode (Node)
ragdoll1 Foot.R Foot.L_attachnode (Node)
attempt at ragdoll bone-ragdoll bone Note:also tried rigidbodys
[java]public void collide(Bone bone, PhysicsCollisionObject object, PhysicsCollisionEvent event) {
if (object.getUserObject() != null && (object.getUserObject() instanceof CollisionShape)) {
//Geometry geom = (Geometry) object.getUserObject();
/*if ("Floor".equals(geom.getName())) {
return;
}*/
// if(animControl.getSkeleton().getBoneIndex(bone) == -1) return;
// One of many attempts
if((CollisionShape)object.getUserObject() == ragdoll2.getBoneRigidBody(bone.getName()).getCollisionShape()) //
System.out.println("ragdoll1 "+bone.getName() +" "+ object.getUserObject().toString()); //<
sends messages to console
}[/java]
result
no output
so Yes or No should the above send similar messages as above to the console..... if No am I
A) using the wrong physics object
B) do I need to pass more info to jme, if so, what, because I have even "flesh out" the collision event to no avail
It is not that the collision aren't happening.... I'm pretty sure ...they are .....just can't seem to get Acknowledgement of those collisions from JME3 via the ragdoll Listener
I dont know how much clearer I can be
@mcbeth said:
yes I know that............just cant get the ragdoll rigidbody on ragdoll rigidbody contacts "reported and filed" like ragdoll on Spatial get happily "reported and filed" for all the world to see, that's all ........hell I even tried!
...yet the dancing ogre falls each time I hit him with a ball.. magic!
dude :x your’e not “listening”
I wrote above
output from geoms
ragdoll1 Foot.R Box (Geometry)
ragdoll1 Foot.R Box (Geometry)
that’s output from the console that proves what u say here
@normen said:
...yet the dancing ogre falls each time I hit him with a ball.. magic!
the ball is Geometry which extends spatial ......Not so? Ragdoll bone on Geometry or Node collisions report fine I am not complaining about that...... Ragdoll bone on Ragdoll bone dont report
e.g. Foot bone rigidbody kicks Chest bone rigidbody.................surely this is so hard even with the language barrier
geometry etc. has nothing to do with physics collision :?
I know nothing about ragdolls but maybe you need a simple test case showing the problem Mcbeth to help people understand?
right so why does balls, boxes and nodes or MORE ACCURATELY their rigid bodies get reported to the console when they contact the ragdoll( i.e its rigid bodys), but a ragdoll’s rigid bodies dont sends messages when it makes contact with another ragdoll’s rigid bodies
in the same way as you so smugly suggest the ball bounces of sinbad in the stock tests and I can get a message to the console based on that collision … but I cant get two sinbads that are touching each other to output to the console the bones doing the touching when the two ragdolls interect… thats what I’m after
The only difference is that they are kinematic when you play animations…
And by the way, all your collision code seems to base on the user object, I think that is used somehow else for the rag doll, maybe thats where the event gets dropped.
Just remove your checks for null and instanceof of he user object, did you check that?
@normen said:
Just remove your checks for null and instanceof of he user object, did you check that?
ok I'll try that thanks