How to recoil the Camera Up??,How to recoil the Camera Up
The recoil back and forward was made using coroutine and Lerp like this, ``` Vector3 recoilBack = new Vector3(currentGun.retroActionForce, originPos.y, originPos.z); Vector3 retroActionRecoilBack = new...
View ArticleGun will not shoot, shows error.
i made a gun script. that shows error: NullReferenceException: Object reference not set to an instance of an object gun.Shoot () (at Assets/code/gun.cs:132)<---- see script 1 (see void Shoot for...
View ArticleAssets\Charactershoot.cs(6,12): error CS0246: The type or namespace name...
using System.Collections; using System.Collections.Generic; using UnityEngine; public class charactershoot : MonoBehaviour { public Gun gun; public int shootButton; public KeyCode reloadKey; void...
View ArticleChanged the hitbox for my aim, but the game is still centered the gun at the...
My code is made to make the gun circle 0, 0, 0, but I made the hitbox go up by +1 so it is now 0, 1, 0, but the gun is still circling the 0, 0, 0 position, how to do I change the code is it looks in...
View Articleanother problem with bullets
I have problem with my bullets It don't collision or something like that and It's writing this **ERROR** **Tag: Bullet is not defined. UnityEngine.StackTraceUtility:ExtractStackTrace ()...
View ArticleI want an enemy to take damage from a projectile (A Certain Layer Named Bullet)
So I added damage and health to the enemy but i dont know how to make him get damaged from a certain projectile here's the code public void TakeDamage(int damage) { health -= damage; if (health <=...
View ArticleCircular Bullet Spread for Shotgun / Bloom
Hello All, I am currently trying to make a shotgun script for my game. I want to add a bullet spread to each bullet. I want to bullet spread to be in a circle though not a square. The Shoot function is...
View ArticleHow do I make it so that my bullet doesn't just delete anything it touches...
public class Bullet : MonoBehaviour { public float life = 3; void Awake() { Destroy(gameObject, life); } void OnCollisionEnter(Collision collision) { Destroy(collision.gameObject); Destroy(gameObject);...
View ArticleI currently have a 3D Unity game with a movement system and such, Even though...
I've looked at alot of tutorials but I still don't know how to make one. Perhaps can anyone help?
View ArticleHow do I automatically target a random enemy within a certain range and...
In my game, you control a tank, and you have two guns, one which is aimed by you, the player, and one which automatically aims at an enemy within range. All of my enemies are tagged Enemy. I want the...
View ArticleHow do I fire multiple bullets in an arc?
I have a variable `projectileNum` and when it is set to one, it works perfectly, but when it is above that, nothing I do gets it to work. If I use a for or while loop, it fires multiple bullets, but...
View ArticleHow do I make it so I only damage the enemy once?
I recently made a pretty simple FPS game, where you shoot bullets (which are gameObjects) at enemies. I made it so that each Bullet does 5 damage, and that the Enemy has 50 health. So it should take 10...
View ArticleBullet not affecting health
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Gun : MonoBehaviour { public Transform firepoint; public GameObject bulletPrefab; void Start() { } // Update...
View ArticleGranade script
Hi people. I need a good granade script for my game. the actual script what i'm using is this: public class BulletSc : MonoBehaviour{ [SerializeField] public Rigidbody rb; [SerializeField] public...
View ArticleHow can the ammo go to 31 at the start of a game?,How can I make The current...
How can I make it that the ammo goes toe 31 at the start of the game? using UnityEngine; public class Gun : MonoBehaviour { [Header("References")] [SerializeField] private GunData gunData;...
View ArticleHow to lerp rotate the gun to the opposite of ur mouses X position and clamp it
i wanna lerp the position of the gun to the position of the gun + the mouse x position but i dont want the gun to rotate more than -30 and 30 on the y axis... pls help i have no idea how to even start...
View ArticleHow to bring reticles in different situations to the center of the camera?
I'm making a part to look into the optical sight and scope when aiming in an FPS game now. The gun is a child object of the right hand when it is not aimed, but when it is aimed, it has a parent-child...
View ArticleHow to disable the previous child object of a parent,How to disable previous...
Essentially im using a gameobject to store guns that the player has access to and there is a script that allows the player to pickup a weapon. however when the player picks up the weapon it doesnt...
View ArticleChanging character X axis rotation so that gun points at target issue
Good evening everyone! I am making a WWII shooter and currently working on the AI I am simply trying to have the back of my character move up or down in order for my gun object to point at the target...
View Article2D gun aiming problem
Hi, I'm working on a 2d game where the player holds a weapon and aim /flip with the cursor. When the player is flipped, the rotation / aiming with the mouse isn't fluid anymore, the player is not able...
View Article