Download

OnComponentBeginOverlap event: How to determine if e.g. a knife is cutting or stabbing?

Hi,

I have a knife/blade component with which I want to cut/stab other static mesh components. This is for VR (Vive), the knife is attached to the motion controller, so it has total freedom of movement.

So far I use the OnComponentBeginOverlap event of the static mesh I want to cut, to check if the the other component is indeed the knife and if it has enough linear velocity to have any effect.

But now I want to discriminate the movement of the knife (relative to the static mesh) to see if it is stabbing or cutting. And also, ideally, if the sharp or the blunt edge of the knife is hitting the static mesh, to only initiate cutting in the first case.

I think it should be possible to calculate this from the two transforms, their relative angles/rotations etc., but I am lost how exactly to do this.

Any hints, please?

You could, get the dot product of the knife’s normalized velocity and say, it’s forward vector
and if the dot product result is more than, 0.6 you could consider that motion stabbing motion

and for slashing, you could get the;
dot product of the knife’s normalized velocity and it’s up vector ( assuming the blade edge is pointing down) depends on how the knife is orientated by default
and if this dot product is less than, -0.6 you could consider that motion to be a slashing motion

Thank you very much, I will try that!