In your example, those are the start location and end location of the weapon in world space.
What about getting start transform in enableGhostCollision (now should be renamed to getStartTransform) and end transform in disableGhostCollision (now should be renamed to getEndTransform) then do a sweepTest.
video
You can see it in the video I made three attacks
The first time is to face the target The attack of the weapon missed
The last two attacks were carried out by standing on the side of the model
The weapon hit the target
sweepTest The middle swing animation that is only detected at the beginning and end of the weapon is not detected
What did I do wrong?
public void getStartTransform(){
SkinningControl modelSkinningControl = ((Node)modelSyana.model).getChild(0).getControl(SkinningControl.class);
//modelSkinningControl.getAttachmentsNode("Bone023").addControl(ghostControl);
Start = modelSkinningControl.getAttachmentsNode("Bone023").getWorldTransform().clone();//((Node)modelSyana.model.getChild(0)).getChild(0).getWorldTransform();modelSkinningControl.getAttachmentsNode("Bone023").getWorldTransform();
}
public void getEndTransform(){
List<Vector3f> centers = new ArrayList<>(2);
centers.add(new Vector3f(0f, 0.5f, 0f));
centers.add(new Vector3f(-0.5f, 3f, -0.5f));
List<Float> radii = new ArrayList<>(2);
radii.add(0.5f);
radii.add(0.5f);
MultiSphere shape = new MultiSphere(centers, radii);
SkinningControl modelSkinningControl = ((Node)modelSyana.model).getChild(0).getControl(SkinningControl.class);
End =modelSkinningControl.getAttachmentsNode("Bone023").getWorldTransform().clone();//((Node)modelSyana.model.getChild(0)).getChild(0).getWorldTransform();
List<PhysicsSweepTestResult> sweep = bulletAppState.getPhysicsSpace().sweepTest(shape,Start,End);
for(int i=0;i<sweep.size();i++){
System.err.println(sweep.get(i).getCollisionObject());
}