So, my idea is to have a knife with a collider and rigidbody and a board with a collider and rigidbody as well.
once i apply the impulse force to the knife in up direction, i expect it to hit the board and i once it hits it, it will trigger the “collisionEnter” event, and at that time ill make the rigidbody of knife as static, so that it doesnt fall down, but what i am experiencing is that, the knife stops before even it collides.
My bad, and sorry, if the video was confusing, i had its bodytype as dynamic earlier and thus it was falling down before i hit the button to shoot it up.
Now i have made it static in the beginning in the editor and making it dynamic before i apply the force using the script(as shown in the above script in ShootKnife Function).
I really appreciates the effort and thankyou
But yes it needs the collision detection, as further down the development, i will be instantiating 2nd knife once the 1st knife hits the board, and then shooting the 2nd knife will instantiate the 3rd one and so on…
if the player fail to hit the board and instead hits any of the knife which is already attached to the board the knife falls back,
So, physics simulation and collision detection with the other knifes is needed.
But its not about the alternative workaround as of now, its more about why its showing unexpected behavior.
its happening quite often.
But what i have noticed it, if the impulse force is high, the gap between them is more.
This is the project https://playcanvas.com/project/1260776/overview/kinfeboard
and i have made you as an admin, is that fine by you?
I appreciate it,
I too thought, this could be the case of CCD, but i would have considered this, if the knife would have passed trough the target instead, but as of now the scenario is that, its invoking the collision event even before it actually collides.
But thanks, leeme dig into this a bit more.
The thing to remember here is that it’s doing a physics simulation, its never going to be exactly touching because the physics has simulated the knife hitting the circle and bouncing off in the physics step/update
Th collision callback event should give you the contact point where they touched. What I would do is:
Wait for collision callback
Convert the knife to kinematic
Parent the knife to the spinning circle (assuming that it’s scale is 1, 1, 1)
Move the knife global position so that the tip is at the point of contact which is in the data returned from the collision callback
I just moved a knife made of some planes that was a child of a point that when it reaches the same y value of the rotation object it stops moving and rotates.
If I had to prevent knives from hitting other knives I would actually keep a separate collision and rigidbody disabled on every knife and enable it when it reaches 1, then just disable the entity so it “breaks”.