ETeeskiTutorials FPS1 Problem Diagnostic Collaboration Thread

Click Here to go to the FPS1 Tutorial Playlist

This video explains the idea of this thread:

Screw what I said in the video, just post your glitches and questions in this thread.

Be sure so scroll through other people’s posts here; Someone else might have had the same problem as you, or you may find someone who is having a problem that you figured out last week.
I will still personally try to respond and help everyone with whatever problems they are having, and I think I will be able to do this more effectively on the forums.

Here’s a link to a video by ReaperZ1997 on how to fix the gun rotation and position:
http://www.youtube.com/watch?v=TGyTGD7yRo0

Hi,
Great tutorials :smile:

FPS1.19

When walking with the headbob script my gun is going crazy shaking all over the place.

I’ve changed Update to LateUpdate but it’s still shaking when I walk

Hey im replying to your comment on the youtube video 1.23, im TheHellhound17

My camera shakes like crazy when i walk but the weapons swaps fine and thats all working.
My scripts are on this post

http://forum.unity3d.com/threads/126441-FPS-Problem-glitchy-walking?p=852161#post852161

How about a tutorial on how to create a first-person camera conversion to third person camera. Using the scroll wheel to move between them or automated for “cut” sequences?

FPS1.31 Stairs. Unity3D FPS Game Design Tutorial.

stair colliders not working when i go through them backwards.

link to my thread - http://forum.unity3d.com/threads/126722-ETeeski-1.31-stairs-colliders-not-working-when-running-through-them-backwards?p=854258#post854258

I’m currently working of a true FPS. I use your scripts Eteeski and another guy’s totorial.

I have a problem with moving my character rig were the camera is facing.

THREAD ----------------------------------->>>>>>>>> http://forum.unity3d.com/threads/126874-True-fps-problem-!!!?p=855523#post855523

FPS 1.8

i have a strange proble when aiming left to right;

http://forum.unity3d.com/threads/127384-ETeeskiTutorials-Player-Look-Issue?p=859507#post859507

FPS 1.8 Basic Gun With Weight

Two Issues: My variables for the gun’s position were screwed up and when I added the rest of the code the gun changes position on the z axis when I look up/down. PLEASE HELP

http://forum.unity3d.com/threads/127929-Eteeskitutorials-Scripting-Problem-FPS-1.8?p=863647#post863647

FPS 1.23 Swiching Guns

the problem with my code its that not switching guns and its saing some mesage like
null reference and stuff

http://forum.unity3d.com/threads/128189-FPS-Chapter-1.23-It-Wont-Swich-Guns?p=865674#post865674

FPS 1.23 Swiching Guns

the problem with my code its that not switching guns and its saing some mesage like
null reference and stuff

http://forum.unity3d.com/threads/128189-FPS-Chapter-1.23-It-Wont-Swich-Guns?p=865674#post865674

I have a problem! on the tutorial: FPS1.19 Headbob Movement. Unity3D FPS Game Design Tutorial.

The problem is that on every variable I make it has 2 errors on them, one saying unexpected symbol Colon and one saying unexpected symbol Equal.

Can anyone help me? Heres the linc:

http://answers.unity3d.com/questions/229801/eteeskitutorials-fps-game-problem.html

FPS 1.30 Opening and Closing Doors

the problem is that it doesnt open the door or hear sounds when i press E while i get no error.

Thread : http://answers.unity3d.com/questions/230656/eteeskitutorial-fps130-opening-and-closing-doors.html

What video covers the UseKey script, which supposedly is in the video dealing with picking up guns?. A video I haven’t been able to find. Quick help would be much appreciated, as I’m kind of on a deadline here and this one little thing is hanging me up.

My gun has sort of a jittering motion? If that makes sense. The gun jumps left and right slightly when I rotate the screen and it does it more profusely when I move forward and rotate. And I skipped 1.23 and went to 1.24 because I wanted to do some stuff but didn’t have enough time for a long vid, so I did 1.24 and then did 1.23

EDIT: Also I didn’t add the script because I don’t think it has to do with my script. I will if you tell me to. And changing the layer from guns doesn’t change anything

Link: http://forum.unity3d.com/threads/129416-FPS1.24-Rotating-screen-(EteeskiTutorials)?p=874783#post874783

Hi ETeeski,

I have a generic question, of something I noticed while using my imported gun model.

For some reason, when I am zoomed out the Raycast is not centered on screen. At least, that’s what I think as the bulletHole object gets created off center to the right.

When aiming it’s all perfect. It lines up perfectly with the gun. Just as soon as I am zoomed out the bullets are offset to the side.

Is this something I can fix in code? Or something that I have to fix in the Inspector?

I have my gun’s local coordinates at x: 0, y: 0, and z: 0.75.

My thread can be found here http://forum.unity3d.com/threads/129888-Raycast-doesn-t-get-centered?p=876420#post876420, where you can also find a link to a early iteration of my FPS which seems to be having the same issue.

Hi ETeeski,
first thank you very much for these instructive tutorilas. In FPS1.11, I’d like to understand why we use - as in other parts of the code - both smoothDamp and Lerp to get a smooth transition. ¿Wouldn’t be enough to smoothDamp between both camera FOVs?
My thread: http://forum.unity3d.com/threads/129959-FPS1.11-ETeeski-Tutorials

Another generic Gameplay question: When pressing both A+S or A+W or D+S or D+W (ergo: Horizontal Vertical movement at the same time) the character walks diagonally at twice the speed it is allowed to move, even though the maxWalkSpeed is set.

Is there a way to always limit the movement speed to maxWalkSpeed? Even if multiple keys are pressed?

Hey,
For my character he is using a capsule collider and rigid body for a movement motor.
i know you have a tutorial for stairs but that doesn’t apply for the capsule collider and rigid body.
Is there any way to edit the following script to create like a step offset?

var crouchSpeed = 2.0;
var walkSpeed = 8.0;
var runSpeed = 20.0;

var fallDamageMultiplier : int = 2;
var fallAnimGO : GameObject;
var inAirControl = 0.1;
var gravity = 20.0;
var maxVelocityChange = 10.0;
var canJump = true;
var jumpHeight = 2.0;
var fallSound : AudioClip;
var playerWeapons : GameObject;

var grounded = false;
private var sliding : boolean = false;
private var speed = 10.0;
private var limitDiagonalSpeed = true;
private var crouching : boolean;
private var normalHeight : float = 0.5;
private var crouchHeight : float = -0.2;
private var crouchingHeight = 0.3;
private var hit : RaycastHit;
private var myTransform : Transform;
private var rayDistance : float;
private var mainCameraGO : GameObject;
private var weaponCameraGO : GameObject;

@script RequireComponent(Rigidbody, CapsuleCollider)

function Awake (){
    rigidbody.freezeRotation = true;
    rigidbody.useGravity = false;
	myTransform = transform;
	mainCameraGO = gameObject.FindWithTag("MainCamera");
	weaponCameraGO = gameObject.FindWithTag("WeaponCamera");
	rayDistance = collider.height * .5 + collider.radius;
	playerWeapons.animation.wrapMode = WrapMode.Loop;
}

function FixedUpdate (){
    if (grounded){			
		var inputX = Input.GetAxis("Horizontal");
		var inputY = Input.GetAxis("Vertical");
		var inputModifyFactor = (inputX != 0.0  inputY != 0.0  limitDiagonalSpeed)? .7071 : 1.0;
		
        if (Physics.Raycast(myTransform.position, -Vector3.up, hit, rayDistance)) {
            if (Vector3.Angle(hit.normal, Vector3.up) > 30){
                sliding = true;
				rigidbody.AddRelativeForce (-Vector3.up * 500);
			}else{
				sliding = false;
				
			}	
		}

        // Calculate how fast we should be moving
        var targetVelocity = new Vector3(inputX * inputModifyFactor, 0.0, inputY * inputModifyFactor);
        targetVelocity = myTransform.TransformDirection(targetVelocity);
        targetVelocity *= speed;	
		
        // Apply a force that attempts to reach our target velocity
        var velocity = rigidbody.velocity;
        var velocityChange = (targetVelocity - velocity);
        velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
        velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
        velocityChange.y = 0;
        rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);
   
        
        if (canJump  Input.GetButton("Jump")){
            rigidbody.velocity = Vector3(velocity.x, CalculateJumpVerticalSpeed(), velocity.z);
        }
		
		if(!crouching){
            if (grounded  Input.GetButton("Run")  Input.GetKey("w"))
				speed = runSpeed;
			    else 
			    speed = walkSpeed;
			}else{
			speed = crouchSpeed;
		}
	
	}else{
	
		// AirControl 
		targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
		targetVelocity = transform.TransformDirection(targetVelocity) * inAirControl;
		rigidbody.AddForce(targetVelocity, ForceMode.VelocityChange);
	} 

    // Gravity 
    rigidbody.AddForce(Vector3 (0, -gravity * rigidbody.mass, 0));
    grounded = false;
}

function OnCollisionStay (col : Collision){
	if (Physics.Raycast(myTransform.position, -Vector3.up, hit, rayDistance)) {
		grounded = true;
	}	
}

function HitJumpPad(velocity: float) {
       rigidbody.velocity.z += velocity;
    }

function OnCollisionEnter (collision : Collision){
    if(!grounded){
		fallAnimGO.animation.CrossFadeQueued("Fall", 0.3, QueueMode.PlayNow);
		var currSpeed : float = collision.relativeVelocity.magnitude;
		
		if (currSpeed > 20) {
			var damage : float = currSpeed * fallDamageMultiplier;
			Debug.Log ("FallDamage" + damage);
			SendMessage ("PlayerDamage", damage, SendMessageOptions.DontRequireReceiver);
		}	
	}	
}

function CalculateJumpVerticalSpeed (){
    return Mathf.Sqrt(2 * jumpHeight * gravity);
}

function Update(){

	if (grounded  rigidbody.velocity.magnitude < (walkSpeed+2)  rigidbody.velocity.magnitude > (walkSpeed-2)  !Input.GetButton("Fire2")){
		playerWeapons.animation.CrossFade("Walk");
		
	}else if (grounded  rigidbody.velocity.magnitude < (runSpeed+2)  rigidbody.velocity.magnitude > (runSpeed -2)){
		playerWeapons.animation.CrossFade("Run");
		
	}else if (grounded  rigidbody.velocity.magnitude < (crouchSpeed+1)  rigidbody.velocity.magnitude > (crouchSpeed-1)  Input.GetButton("Fire2"))
	    playerWeapons.animation.CrossFade("CrouchAim");
	
	else
	    playerWeapons.animation.CrossFade("IdleAnim");
		
	
	if(mainCameraGO.transform.localPosition.y > normalHeight){
		mainCameraGO.transform.localPosition.y = normalHeight;
	} else if(mainCameraGO.transform.localPosition.y < crouchHeight){
		mainCameraGO.transform.localPosition.y = crouchHeight;
	}
	
	if(weaponCameraGO.transform.localPosition.y > normalHeight){
		weaponCameraGO.transform.localPosition.y = normalHeight;
	} else if(weaponCameraGO.transform.localPosition.y < crouchHeight){
		weaponCameraGO.transform.localPosition.y = crouchHeight;
	}
	
	if (Input.GetButtonDown("Crouch")  !crouching) {
        collider.height = 1.5;
		collider.center = Vector3 (0, -0.25, 0);
		crouching = true;
	} 

	if(Input.GetButtonUp("Crouch")  crouching){
		collider.height = 2.0;
	    collider.center = Vector3 (0, 0, 0);
        crouching = false;
	}
	
	if(crouching){
		if(mainCameraGO.transform.localPosition.y > crouchHeight){
			if(mainCameraGO.transform.localPosition.y - (crouchingHeight * Time.deltaTime/.1) < crouchHeight){
				mainCameraGO.transform.localPosition.y = crouchHeight;
			} else {
				mainCameraGO.transform.localPosition.y -= crouchingHeight * Time.deltaTime/.1;
			}
		}
		if(weaponCameraGO.transform.localPosition.y > crouchHeight){
			if(weaponCameraGO.transform.localPosition.y - (crouchingHeight * Time.deltaTime/.1) < crouchHeight){
				weaponCameraGO.transform.localPosition.y = crouchHeight;
			} else {
				weaponCameraGO.transform.localPosition.y -= crouchingHeight * Time.deltaTime/.1;
			}
		}

	} else {
		if(mainCameraGO.transform.localPosition.y < normalHeight){
			if(mainCameraGO.transform.localPosition.y + (crouchingHeight * Time.deltaTime/.1) > normalHeight){
				mainCameraGO.transform.localPosition.y = normalHeight;
			} else {
				mainCameraGO.transform.localPosition.y += crouchingHeight * Time.deltaTime/.1;
			}
		}
		if(weaponCameraGO.transform.localPosition.y < normalHeight){
			if(weaponCameraGO.transform.localPosition.y + (crouchingHeight * Time.deltaTime/.1) > normalHeight){
				weaponCameraGO.transform.localPosition.y = normalHeight;
			} else {
				weaponCameraGO.transform.localPosition.y += crouchingHeight * Time.deltaTime/.1;
			}
		}
	}
}

function Accelerate (accelerateY : float, accelerateZ : float){
    grounded = false;
	rigidbody.AddRelativeForce (0, accelerateY, accelerateZ);	
}

I have problem when i set gunCamera depth to 0 , my weapon not recive shadows from another objects how to fix this?

ETeeskiTutorials FPS1 problems…[ FPS 1.18] Muzzle Flash and FPS 1.21: (Basic Crouching)

http://forum.unity3d.com/threads/131388-ETeeskiTutorials-FPS1-problems…-FPS-1.18-Muzzle-Flash-and-FPS-1.21-%28Basic-Crouchi?p=886992#post886992