- Home /
How do I add a force on the final shot with a gun?
I have a raycast gun and when the final bullet hits a player before they die, they get pushed in the opposite direction at the Ray.hit.
How do I do this? I can't figure out how to find the final shot. I can add the force, but I need to add it on the last bullet.
Thank you.
$$anonymous$$eep track of the last shot with the script each time you shoot? It seems pretty straight forward.
// in the shooting portion of the code
if (shooting)
{
create ray
lastRay = ray
}
// later in the script...
add force using lastRay
Unless Im missing something vital?
I can't figure out how you detect the last ray? I am trying to say the ray that hits that ends up killing the player adds an extra force.
Your answer
Follow this Question
Related Questions
How To Access Children of a Parent Object 1 Answer
Trouble with Ray & Raycasting and AddForce() 1 Answer
ray hit probelm 0 Answers
EteeskiTutorials' bullets (raycast bullets with gravity) 1 Answer
How to get information from raycast? 2 Answers