Looking at the AimScript, I created a simple script addon for the ability to drop the flashlight that you are holding (while your gun is holstered).
I ran into an issue with the flashlight colliding with the map. When dropped, sometimes it collides and sometimes it does not, being fairly new to unity I am not quite sure how to solve this issue. Anyone have any ideas?
Here is the code I threw in:
Code: Select all
if(Input.GetButtonDown("Eject/Drop")){
if(holder.has_flashlight)
{
if(gun_instance){
return false;
}
held_flashlight.AddComponent(Rigidbody);
held_flashlight.GetComponent(FlashlightScript).TurnOff();
held_flashlight = null;
holder.has_flashlight = false;
}
}