[java]ghostControl.getOverlappingObjects()[/java]
returns the same overlapping object more than once. Is that working as intended?
My case:
When the GhostControl overlaps with a CharacterControl, the CharachterControl is returned twice.
I guess its because the character consists of a kinematic rigidbody and a ghost object. Are all characters always reported twice?
Yes, all characters are reported twice, but all characters have the same amount of controls attached to them
Yeah, then what I said seems to be right. The Character object itself is two objects, its like that in bullet, internally.
Thx, i checked everything again and encountered the error, it has something to do with the order the objects are added to the physicsspace / Spatial. Rather strange, would you know of this issue?
Code that makes ghostControl1 report a charactercontrol twice, ghostControl2 reports it once
[java]
spatial.addControl(ghostControl2);
spatial.addControl(rigidBodyControl);
getRootNode().attachChild(spatial);
getPhysicsSpace().add(ghostControl2);
getPhysicsSpace().add(rigidBodyControl);
spatial.addControl(ghostControl1);
getPhysicsSpace().add(ghostControl1);
[/java]
Code that works, every ghostcontrol reports the same charactercontrol only once
[java]
spatial.addControl(ghostControl1);
spatial.addControl(ghostControl2);
spatial.addControl(rigidBodyControl);
getRootNode().attachChild(spatial);
getPhysicsSpace().add(ghostControl1);
getPhysicsSpace().add(ghostControl2);
getPhysicsSpace().add(rigidBodyControl);
[/java]
EDIT: updated for the sakes of simplicity
Sorry, i forgot that it seems rather confusing for someone reading this
I updated the code, i think its clear now.
I mean, it works now, but i checked every constructor and dependency between these 3 controls, cant find the error.
If this has something to do with the API, we have to find the error!! If not, we have to find the error in my code to be sure the API is errorless
I dont know all these classes? Maybe you have two ghost controls in your ability trigger?
Nah forget it, it has something to do with my code, since for every other situations its working
Thx again and sorry for wasting your time
Topic solved
… I told you that one character is two bullet objects, so this doesn’t necessarily have to be an error…
hmm ok
to recap for everyone out there reading this post: check for uniqueness of overlapping objects between PhysicsCharacter (or any subclasses) and PhysicsGhostObject (or any subclasses)