Trying to make it so i can just use the First person controller prefab as a basic FPS controller to just get an idea of how my game will work. I just started this stuff a couple days ago and know barely any java script, but thanks to Tornado Twins got a good idea of what to do. I've got the script down and it shoots fine, I added the spawn point of the bullets in front of the player and dropped it in the Controller Prefab, now if i move the camera left or right, the spawn point does to and i can turn my gun, but if i try to look up or down the spawn point stays at the same height and doesnt rotate, any idea how to fix it? heres the parts i added to the FPSWalker script: (note i took out a lot of the script, just parts i manually put in)
if(Input.GetButtonDown("Fire1"))
{
var bullit = Instantiate(bullitPrefab, GameObject.Find("SpawnPointTwo").transform.position, Quaternion.identity); bullit.rigidbody.AddForce(transform.forward * 2000);
} if(Input.GetButtonDown("Fire2")) { var bullits = Instantiate(bulletPrefab, GameObject.Find("SpawnPointTwo").transform.position, Quaternion.identity); bullits.rigidbody.AddForce(transform.forward * 8000); }
I put this right after the jump button, outside of the if on ground part. (i also added the variables on top so thats fine too). I dont know if i should even attempt to attach this in the mouse move script and see if that fixes it or is that not the problem? please help if you can :)