Hand and gun rotation problem, Third Person Shooter
Hello, I'm facing a problem with Unity. I'm working on a TPS game. My problem is that I want to make my character's hand always keep the same rotation (perpendicular to the ground), but the problem is...
View Articlenot losing ammo when shooting
i have a script that shots raycasts, and there's a function that reloads (3 seconds) and after those 3 seconds are up, the player has unlimited ammo for a short amount of time. The currentAmmo variable...
View Article2 Guns aren't meant to fire together but they do
Hi. I have two guns on my spaceship. When the player presses space, the 2 guns are meant to fire half a second apart from each other. However, they currently fire together then wait five seconds before...
View ArticleShotguns with raycasts
Is there a way to make a gun shoot multiple bullets (like a shotgun) using raycasts?
View ArticleHow to add fire rate/Force to my gun
Hi, I would like to know how to add force and my fire rate to my gun script. If you could help me that would be great. here is the code in C# using UnityEngine; using System.Collections; public class...
View ArticleWeapon Switching when reload animation is playing
I'm working on a FPS Game and everything seems to work but i have a problem : i have 3 weapons, i'm reloading the first one and switch to the second one with the mouse scrollwheel. When i switch back...
View ArticleRandom Gun Generation
Hello! So a main mechanic of a game I am working on is random gun drops. Very similar to Borderlands style but the game itself is a roguelike. I've already written a script that randomly generates gun...
View Articlehow to make my gun not fire while paused
i tried to make my gun not fire while the game is paused becasue the gun fires by using update to detect a mouse click but its not working here is my code: using System.Collections; using UnityEngine;...
View ArticleHow can I "maintain" the variables of my randomly generated guns?
Hello! I've created a script that generates random stat variables for guns. There's more to this script that isn't shown, but here's a simplified version that's still the same premise... public class...
View ArticleObjects instantiate at prefab location instead of playtime location
When I instantiate my bullets from my gun at my gun barrel in the Shoot() function it instantiates at the (0,0,0) location it is on my prefab object. But when I instantiate it in the Update function it...
View ArticleHow do i just rotate the gun while it should follow the camera?
So i want to make a recoil for my gun in my fps shooter that rotates the gun a bit backwarts. The gun is a child of the camera so that the gun rotates with it. But the problem is when i set the...
View Articlewhy does my raycast stop working after a few seconds?
i have a gun that uses a raycast to detect an enemy. before this code was working perfectly but now when i shoot an enemy after i wait a couple seconds the raycast does not detect the enemy this is the...
View ArticleMove Camera and Gun Separately
I want to be able to move around my character in first person and aim a weapon but have there be some form of aim lag to "simulate" the idea of their head moving faster than their arm. Originally I had...
View Articleaiming error
My shooting script puts in the console what has been shot at, it works for 2 clicks or so and then doesnt work after that. It uses ray casts and seems to target what isnt centre of the screen( the...
View ArticleHow do i make my gun do damage?
Can someone help me make a new code or edit a code to make my gun do damage? Thanks using UnityEngine; using System.Collections; public class Shooting : MonoBehaviour { public Rigidbody projectile;...
View ArticleAdd force forward will push the bullet up too
Hi, I am currently making a videogame with a gun. I tryed to apply AddForce to the bullet with the transform.forward from the gun. However, when i shoot the bullet (the gun is vertically positioned)...
View ArticleRaycast Gun Fire Rate
Making an aim trainer app in unity 2017.4.17f1 personal for mobile devices. made a script that shoots every time you click: void Update () { if (Input.GetButtonDown ("Fire1")) { Shoot (); } } It worked...
View ArticleRotation Flicker in 2d platformer gun
So I've gotten started with Unity recently, and I have been working on a 2d platformer with shooting. Everything is going smoothly but I couldn't help but notice a little flicker whenever I rotate the...
View ArticleHow can I shoot bullets that you can aim with the crosshair?
I just implemented a shooting mechanism into my gun where bullets are created and move out of the barrel of the gun forwards and since they come from the barrel, their direction doesn't match the...
View ArticleGun not smoothly following player,How to make gun smoothly follow player
So I am making a 3D game on unity and I want my pistol to move with the camera smoothly and not just attached to the camera. I'm not really sure how to explain it properly but what I mean is I want...
View Article