- Home /
Creating a Mounted turret
hey guys i've been trying to figure this out. how can i make a weapon that is mounted (in other words stuck where it is) useable(FPS Game). i have the ability to pick up weapons, but i dont want to "pick it up permanently" but create and get on and off type weapon, similar to the MG in call of duty series and games like that.
thanks in advance
You should try to keep one topic to one tightly related question. If, the physics and audio are "unrelated", then don't put them in this question. Either make a new one or search for it.
Answer by fireDude67 · Nov 30, 2010 at 05:43 AM
Have a trigger zone around the turret and in OnTriggerEnter()
check if user has pushed your Use
button. If they have, make the player invisible (GameObject.visible?
) by using player.gameObject.active = false
and then switching the current Camera
off and the Turret's Camera
on. Then you need to write a script to control the turret
Edit: To make a trigger zone, go to GameObject -> Create Other -> Cube, resize the cube until it is the right size for your trigger zone, then on the box collider check Is Trigger
and remove the Mesh Renderer
. Then tag your player as Player
and then you can check if your player walks into the trigger zone like this:
function OnTriggerEnter(collision : Collider) {
if (collision.gameObject.CompareTag("Player") {
// Player has walked into trigger zone.
}
}
Your answer
Follow this Question
Related Questions
Help with Lerp 0 Answers
FPS - Gun Delay while Rotating 0 Answers
How do i get a weapon to follow the first person controller up and down? 0 Answers