Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ETeeskiTutorials FPS1 Problem Diagnostic Collaboration Thread

Discussion in 'Community Learning & Teaching' started by eteeski, Mar 5, 2012.

  1. Voidist

    Voidist

    Joined:
    Jan 13, 2014
    Posts:
    2
    I have a problem with FPS1.3 my player is following the camera but is not moving when I use WASD or the arrow keys. I have everything set up with the player and the main camera set as the camera object in the script. I think the script for the rigidbody movement no longer is working.

    Code (csharp):
    1.  
    2. var walkAcceleration : float = 5;
    3. var cameraObject : GameObject;
    4. @HideInInspector
    5. var h : float = Input.GetAxis("Horizontal");
    6. @HideInInspector
    7. var v : float = Input.GetAxis("Vertical");
    8.  
    9.  
    10. function Update()
    11. {
    12.     transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLook).currentYRotation, 0);
    13.     rigidbody.AddRelativeForce(h * walkAcceleration, 0, v * walkAcceleration);
    14. }
    15.  
     
  2. Voidist

    Voidist

    Joined:
    Jan 13, 2014
    Posts:
    2
    NVM somehow I copy-pasted the script into a new script and it worked :confused:
     
  3. ianmcmillian

    ianmcmillian

    Joined:
    Dec 31, 2013
    Posts:
    5
    Please guys for the sake of overview do as ETeeski said in his video at the first page, make a post with:

    +name the episode your glitch is in
    +give a short description of your problem
    +and post a LINK to a NEW thread YOU created to discuss this problem furthermore

    DO NOT
    -post complete scripts
    -single compiler errors
    -rage posts

    He even made a video so you don't have to read the rules first if you are too lazy.

    Keep this thread clean please.
     
  4. Redducks100

    Redducks100

    Joined:
    Jul 29, 2013
    Posts:
    1
    I had the same problem but i fixed it!
    SOLUTION :
    targetXRotation = Mathf.SmoothDamp(targetXRotation, cameraObject.GetComponent(MouseLookScript).xRotation, targetXRotationV, rotationSpeed);
    targetYRotation = Mathf.SmoothDamp(targetYRotation, cameraObject.GetComponent(MouseLookScript).yRotation, targetYRotationV, rotationSpeed);

    You have forgot to put the velocity..
     
  5. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    Hi! I'm out of ideas what I'm doing wrong. I'm getting an error even if I copy paste your script. ( -_-)

    FPS1.35 AI Path Finding Moving the Enemy

    I tried everything basically it tells me
    Or if you need the full error message:

    The goal door is never found when I start the game.

    Here's the thread:
    http://forum.unity3d.com/threads/232525-ETeeski-s-FPS1-35-AI-Pathfinding-problem?p=1544220#post1544220

    Thanks!
     
  6. ConstantCarnage

    ConstantCarnage

    Joined:
    Apr 4, 2014
    Posts:
    1
    Hey Eteeski, stuck on 1.37 here. The crowd simulation does no work for me, but I have no script errors. The enemy's rigid body is frozen and the collider is on. What is my problem? Did I screw something up with the tags?
     
  7. eriste

    eriste

    Joined:
    Apr 21, 2014
    Posts:
    2
    For some strange reason when I open up the animation tab it's empty.
     
  8. eriste

    eriste

    Joined:
    Apr 21, 2014
    Posts:
    2
    I tried using your tutorial for making a door open and close with the press of the E button but it doesn't work, do you need to set up the rotation of the Y axis on the door model instead of the door object for it to work? I'm also getting an error that says "NullReferenceException: Object reference not set to an instance of an object DoorScript.Awake () (at Assets/DoorScript.js:19
     
    Last edited: Apr 24, 2014
  9. xThatGuyx1

    xThatGuyx1

    Joined:
    Apr 6, 2014
    Posts:
    7
    FPS1.23 Switching Guns. Unity3D FPS Game Design Tutorial.

    I fixed it...I forgot a "d" in the gunscript -.-
     
    Last edited: May 10, 2014
  10. xThatGuyx1

    xThatGuyx1

    Joined:
    Apr 6, 2014
    Posts:
    7
    FPS1.23 Switching Guns. Unity3D FPS Game Design Tutorial

    Oh...I got this stuff fixed too, Stupid Spelling errors.
     
    Last edited: May 11, 2014
  11. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    595
    Your bullet hole prefab probably needs to be rotated, try rotating both the bullet plane and its null parent 90 degrees
     
  12. 242467

    242467

    Joined:
    Jan 4, 2014
    Posts:
    3
  13. George_Danelia

    George_Danelia

    Joined:
    Sep 30, 2014
    Posts:
    2
    can somebody add more script to eteeski GunScript. like Key for switch On Off Input.GetButton And ButtonDown. for Shoot single Shoot Then Press som key and Shoot Rapid fire.



    var beingHeld : boolean = false;
    var outsideBox : GameObject;
    @HideInInspector
    var countToThrow : int = -1;
    @HideInInspector
    var playerTransform : Transform;
    @HideInInspector
    var playerMovementScript : PlayerMovementScript;
    @HideInInspector
    var cameraObject : GameObject;
    @HideInInspector
    var targetXRotation : float;
    @HideInInspector
    var targetYRotation : float;
    @HideInInspector
    var targetXRotationV : float;
    @HideInInspector
    var targetYRotationV : float;
    var rotationSpeed : float = 0.2;
    var holdHeight : float = -0.1;
    var holdSide : float = 0.4;
    var holdForvard : float = 0.01;
    var racioHipHold : float = 1;
    var hipToAimSpeed : float = 0.1;
    @HideInInspector
    var racioHipHoldV : float;
    var aimRacio : float = 0.4;
    var zoomAngle : float = 30;
    var fireSpeed : float = 10;
    @HideInInspector
    var waitTilNextFire : float = 0;
    var bullet : GameObject;
    var bulletSpawn : GameObject;
    var shootAngleRandomizationAiming : float = 2.5;
    var shootAngleRandomizationNotAiming : float = 8;
    var recoilAmount : float = 0.1;
    var recoilRecoverTime : float = 0.1;
    @HideInInspector
    var currentRecoilZPos : float;
    @HideInInspector
    var currentRecoilZPosV : float;
    var bulletSound : GameObject;
    var shootReloadSound : GameObject;
    var muzzelFlash : GameObject;
    var gunbobAmountX : float =0.02;
    var gunbobAmountY : float =0.02;
    var currentGunbobX : float;
    var currentGunbobY : float;
    var glock : GameObject;
    var stopLdle : Animation;
    var gilzaStop : GameObject;
    var throwGun : GameObject;
    var button : boolean = true;
    var buttonDown : boolean = false;

    function Awake ()
    {
    countToThrow = -1;
    playerTransform = GameObject.FindWithTag("Player").transform;
    playerMovementScript = GameObject.FindWithTag("Player").GetComponent(PlayerMovementScript);
    cameraObject = GameObject.FindWithTag("MainCamera");
    }

    function LateUpdate ()
    {
    if (beingHeld)
    {

    rigidbody.useGravity = false;
    outsideBox.GetComponent(Collider).enabled = false;
    glock.gameObject.GetComponent("GlockAnimationsScript").enabled = true;
    gilzaStop.gameObject.GetComponent("GilzaScript").enabled = true;
    currentGunbobX = Mathf.Sin(cameraObject.GetComponent(MouseLookScript).headbobStepCounter) * gunbobAmountX * racioHipHold;
    currentGunbobY = Mathf.Cos(cameraObject.GetComponent(MouseLookScript).headbobStepCounter * 2) * gunbobAmountY * racioHipHold;

    var holdMuzzelFlash : GameObject;
    var holdSound : GameObject;


    if (Input.GetButtonDown("Fire1"))
    if (Input.GetButton("Fire1"))
    {


    if (waitTilNextFire <= 0)
    {
    if (bullet)
    Instantiate(bullet, bulletSpawn.transform.position, bulletSpawn.transform.rotation);
    if (bulletSound)
    holdSound = Instantiate(bulletSound, bulletSpawn.transform.position, bulletSpawn.transform.rotation);
    if (shootReloadSound)
    holdShootReloadSound = Instantiate(shootReloadSound, bulletSpawn.transform.position, bulletSpawn.transform.rotation);
    if (muzzelFlash)
    holdMuzzelFlash = Instantiate(muzzelFlash, bulletSpawn.transform.position, bulletSpawn.transform.rotation);


    targetXRotation += (Random.value - 0.5) * Mathf.Lerp(shootAngleRandomizationAiming, shootAngleRandomizationNotAiming, racioHipHold);
    targetYRotation += (Random.value - 0.5) * Mathf.Lerp(shootAngleRandomizationAiming, shootAngleRandomizationNotAiming, racioHipHold);
    currentRecoilZPos -= recoilAmount;
    waitTilNextFire = 1;
    }
    }
    waitTilNextFire -= Time.deltaTime * fireSpeed;

    if (holdSound)
    holdSound.transform.parent = transform;
    if (holdShootReloadSound)
    holdShootReloadSound.transform.parent = transform;
    if (holdMuzzelFlash)
    holdMuzzelFlash.transform.parent = transform;


    currentRecoilZPos = Mathf.SmoothDamp(currentRecoilZPos, 0, currentRecoilZPosV, recoilRecoverTime);
    cameraObject.GetComponent(MouseLookScript).currentTarjetCameraAngle = zoomAngle;
    if (Input.GetButton("Fire2"))
    {
    cameraObject.GetComponent(MouseLookScript).currentAimRacio = aimRacio;
    racioHipHold = Mathf.SmoothDamp(racioHipHold, 0, racioHipHoldV, hipToAimSpeed);
    }
    if (Input.GetButton("Fire2") == false)
    {
    cameraObject.GetComponent(MouseLookScript).currentAimRacio = 1;
    racioHipHold = Mathf.SmoothDamp(racioHipHold, 1, racioHipHoldV, hipToAimSpeed);
    }
    transform.position = cameraObject.transform.position + (Quaternion.Euler(0, targetYRotation, 0) * Vector3(holdSide * racioHipHold + currentGunbobX, holdHeight * racioHipHold + currentGunbobY, holdForvard) + Quaternion.Euler(targetXRotation, targetYRotation, 0) * Vector3(0, 0, currentRecoilZPos));
    targetXRotation = Mathf.SmoothDamp(targetXRotation, cameraObject.GetComponent(MouseLookScript).xRotation, targetXRotationV, rotationSpeed);
    targetYRotation = Mathf.SmoothDamp(targetYRotation, cameraObject.GetComponent(MouseLookScript).yRotation, targetYRotationV, rotationSpeed);

    transform.rotation = Quaternion.Euler(targetXRotation, targetYRotation, 0);
    }
    if (!beingHeld)
    {

    rigidbody.useGravity = true;
    outsideBox.GetComponent(Collider).enabled = true;
    glock.gameObject.GetComponent("GlockAnimationsScript").enabled = false;
    gilzaStop.gameObject.GetComponent("GilzaScript").enabled = false;
    stopLdle.animation.Stop("Pistol Idle");

    countToThrow -= 1;
    if (countToThrow == 0)
    rigidbody.AddRelativeForce(0, playerMovementScript.throwGunUpForce, playerMovementScript.throwGunForwardForce);

    if (Vector3.Distance(transform.position, playerTransform.position) < playerMovementScript.distToPickUpGun && Input.GetButtonDown("Use Key") && playerMovementScript.waitFrameForSwitchGuns <= 0)
    {

    playerMovementScript.currentGun.GetComponent(GunScript).beingHeld = false;
    playerMovementScript.currentGun.GetComponent(GunScript).countToThrow = 2;
    playerMovementScript.currentGun = gameObject;
    beingHeld = true;
    targetYRotation = cameraObject.GetComponent(MouseLookScript).yRotation - 180;
    playerMovementScript.waitFrameForSwitchGuns = 2;
    }
    {
    if (Input.GetKeyDown("e"))
    {
    throwGun.audio.Play();

    }
    }

    }
    }
     
  14. George_Danelia

    George_Danelia

    Joined:
    Sep 30, 2014
    Posts:
    2
  15. chazz85

    chazz85

    Joined:
    Aug 8, 2014
    Posts:
    5
    Hi i know this is a old thread but i need help with tutorial 1.23. I'm very expierenced with unity3d and c#. Yet i can't switch guns. Here is my script.
    #pragma strict
    var beingHeld : boolean = false;
    var outsidebox : GameObject;
    @HideInInspector
    var counttothrow : int = - 1;
    var playert : Transform;
    var playerMovement : PlayerMovement;
    var cameraObject : GameObject;
    @HideInInspector
    var targetXRotation : float;
    @HideInInspector
    var targetYRotation : float;
    @HideInInspector
    var targetXRotationV : float;
    @HideInInspector
    var targetYRotationV : float;

    var rotateSpeed : float = 0.2;
    var holdHeight : float = -0.5;
    var holdSide : float = 0.5;
    var ratioHiphold : float = 0.8;
    var toAimspeed : float = 0.1;
    @HideInInspector
    var ratioHipholdv : float;
    var Aimratio : float = 0.4;

    var zoomAngle : float = 30;

    var firspeed : float = 15;
    @HideInInspector
    var waitTillnextfire : float = 0.8;
    var bullet : GameObject;
    var bulletSpawn: GameObject;
    var shootanglerandomaiming : float = 5;
    var shootanglerandomnoaim : float = 15;
    var recoilAmount : float = 0.5;
    var recoilRecoverTime : float = 0.2;
    @HideInInspector
    var currentrecoilZpos : float;
    @HideInInspector
    var currentrecoilZposV : float;
    var BulletSound : GameObject;
    var muzzelflash : GameObject;
    var gunbobamountX : float = 0.5;
    var gunbobamountY : float = 0.5;
    var currentgunbobX : float;
    var currentgunbobY : float;
    function Awake(){
    counttothrow = -1;
    playert = GameObject.FindWithTag("Player").transform;
    playerMovement = GameObject.FindWithTag("Player").GetComponent(PlayerMovement);
    cameraObject = GameObject.FindWithTag("MainCamera");
    }

    function Start () {

    }

    function Update () {
    if(beingHeld ){
    rigidbody.useGravity = false;
    outsidebox.GetComponent(Collider).enabled = false;


    currentgunbobX = Mathf.Sin(cameraObject.GetComponent(Mouse).headbobstepcoynter) * gunbobamountX * ratioHiphold;
    currentgunbobY = Mathf.Cos(cameraObject.GetComponent(Mouse).headbobstepcoynter * 2) * gunbobamountY * ratioHiphold;


    var holdmuzzel : GameObject;
    var holdSound : GameObject;
    if(Input.GetMouseButtonDown(0)){
    if(waitTillnextfire <= 0){
    if(bullet){
    Instantiate(bullet,bulletSpawn.transform.position,bulletSpawn.transform.rotation);
    if(BulletSound)
    holdSound = Instantiate(BulletSound,bulletSpawn.transform.position,bulletSpawn.transform.rotation);
    if(muzzelflash)
    holdmuzzel = Instantiate(muzzelflash,bulletSpawn.transform.position,bulletSpawn.transform.rotation);
    targetXRotation += (Random.value - 0.5) * Mathf.Lerp(shootanglerandomaiming,shootanglerandomnoaim,ratioHiphold);
    targetYRotation += (Random.value - 0.5) * Mathf.Lerp(shootanglerandomaiming,shootanglerandomnoaim,ratioHiphold);
    currentrecoilZpos -= recoilAmount;

    waitTillnextfire = 1;
    if(holdSound)
    holdSound.transform.parent = transform;
    if(holdmuzzel)
    holdmuzzel.transform.parent = transform;

    }
    }
    }
    waitTillnextfire -= Time.deltaTime * firspeed;
    currentrecoilZpos = Mathf.SmoothDamp(currentrecoilZpos,0,currentrecoilZposV,recoilRecoverTime);

    cameraObject.GetComponent(Mouse).Currenttargetcameraangle = zoomAngle;


    if(Input.GetMouseButton(1)){
    cameraObject.GetComponent(Mouse).CurrentaimRatio = Aimratio;
    ratioHiphold = Mathf.SmoothDamp(ratioHiphold,0.5,ratioHipholdv,toAimspeed);

    }
    if(Input.GetMouseButton(1) == false){
    cameraObject.GetComponent(Mouse).CurrentaimRatio = 1;
    ratioHiphold = Mathf.SmoothDamp(ratioHiphold,1,ratioHipholdv,toAimspeed);
    }

    transform.position = cameraObject.transform.position + (Quaternion.Euler(0,targetYRotation,0)* Vector3(holdSide * ratioHiphold + currentgunbobX,holdHeight * ratioHiphold + currentgunbobY,0)+ Quaternion.Euler(targetXRotation,targetYRotation,0)* Vector3(0,0,currentrecoilZpos));

    targetXRotation = Mathf.SmoothDamp(targetXRotation,cameraObject.GetComponent(Mouse).XRotation,targetXRotationV,rotateSpeed);
    targetYRotation = Mathf.SmoothDamp(targetYRotation,cameraObject.GetComponent(Mouse).YRotation,targetYRotationV,rotateSpeed);

    transform.rotation = Quaternion.Euler(targetXRotation,targetYRotation,0);
    }
    if(!beingHeld){
    rigidbody.useGravity = true;
    outsidebox.GetComponent(Collider).enabled = true;
    counttothrow -= 1;
    if(counttothrow == 0)
    rigidbody.AddRelativeForce(0,playerMovement.throwgunupforce,playerMovement.throwgunforwardforce);
    if (Vector3.Distance(transform.position, playert.position) < playerMovement.disttopickupgun && Input.GetKeyDown(KeyCode.E)&& playerMovement.waitframeforswitchguns <= 0){
    Debug.Log("Switchs");
    playerMovement.currentgun.GetComponent(Gun).beingHeld = false;
    playerMovement.currentgun.GetComponent(Gun).counttothrow = 2;
    playerMovement.currentgun = gameObject;
    beingHeld = true;
    targetYRotation = cameraObject.GetComponent(Mouse).YRotation = 100;
    playerMovement.waitframeforswitchguns = 2;
    }




    }
    }
    That was gun script heres playermovement(didn't do crouching tutorial didn't want it in my game)
    #pragma strict
    var currentgun : GameObject;
    var disttopickupgun : float = 3;
    var throwgunupforce : float = 100;
    var throwgunforwardforce : float = 300;
    var waitframeforswitchguns : int = -1;
    var walkAcceleration : float = 1;
    var walkDecceleration = 2;
    var maxwalkspeed : float = 10;
    var Horizontalmovement : Vector2;


    var cameraObject : GameObject;
    function Update(){
    waitframeforswitchguns -= 1;
    Horizontalmovement = Vector2(rigidbody.velocity.x,rigidbody.velocity.y);
    if(Horizontalmovement.magnitude > maxwalkspeed){
    Horizontalmovement = Horizontalmovement.normalized;
    Horizontalmovement *= maxwalkspeed;

    }
    rigidbody.velocity.x = Horizontalmovement.x;
    rigidbody.velocity.y = Horizontalmovement.y;
    if(Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0 ){
    rigidbody.velocity.x/=walkDecceleration;
    rigidbody.velocity.z/=walkDecceleration;
    }





    transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(Mouse).currentYRotation, 0);
    rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration,0,Input.GetAxis("Vertical") * walkAcceleration);

    }
    function OnGUI(){
    GUI.Label(Rect(Screen.width/2.01,Screen.height/2.12,200,200),"X");

    }


    Please help please :)
     
  16. ibrag474

    ibrag474

    Joined:
    Nov 23, 2014
    Posts:
    2
    Hi, I'm overwrite your code from your lesson FPS1.2 and Unity said me Mouse Y and
    Mouse X can not be assigned. So how can I solve this problem?
     
    Last edited: Nov 30, 2014
  17. ibrag474

    ibrag474

    Joined:
    Nov 23, 2014
    Posts:
    2
    Somebody can help me?
     
  18. Methaq

    Methaq

    Joined:
    Dec 7, 2014
    Posts:
    4
    hi what is up man look i found y the gun not shooting on sky because it's not tag but i have another problem here my gun aim or go too height when i press left click or u know what i mean and i will be thanks for you you the best lol
     
  19. Methaq

    Methaq

    Joined:
    Dec 7, 2014
    Posts:
    4
    NullReferenceException: Object reference not set to an instance of an object
    Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
    Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
    Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name)
    UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
    GunScript.LateUpdate () (at Assets/GunScript.js:101)
     
  20. Quinhocisco14

    Quinhocisco14

    Joined:
    Feb 9, 2014
    Posts:
    1
    I need help in FPS 1.3 Basic Walking/Running

    #pragma strict

    var WalkAccelaration : float = 5;
    var CammeraObject : GameObject;


    function Update ()
    {
    transform.rotation = Quaternion.Euler(0, CammeraObject.GetComponent(MouseLookScript).CurrentYrotation, 0);
    rigidbody.AddRelativeForce(Input.GetAxis("Horizontal")) * WalkAccelaration,0, Input.GetAxis("Vertical") * WalkAccelaration;
    }

    as ERRORS I get unexpected token 0, . and ,
     
  21. olhari

    olhari

    Joined:
    Mar 8, 2015
    Posts:
    5
    Hii, i need help with the AI PathFinding FPS1.33 AI PathFinding Making a Map.


    I am trying to translate your JVScript into C#. But i don't have the same result as you. Here is my translated script


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class AIpathCell : MonoBehaviour
    6. {
    7.     public List<GameObject> doors = new List<GameObject>();
    8.    
    9.     void OnTriggerEnter (Collider other)
    10.     {
    11.         if (other.tag == "AIpathDoor")
    12.         {
    13.             doors.Add(other.gameObject);
    14.         }
    15.     }
    16. }
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class AIpathDoorScript : MonoBehaviour {
    6.  
    7.     public GameObject[] cells;
    8.     public int[] doorsToCells;
    9.     public List<GameObject> imediateCells = new List<GameObject>();
    10.     public bool testForCells = true;
    11.     public float waitToTestCells = 2;
    12.     public int stage = 1;
    13.    
    14.     public GameObject animatedDoor;
    15.  
    16.     [HideInInspector]
    17.     public bool doorOpen = true;
    18.  
    19.     void Awake ()
    20.     {
    21.         doorOpen = true;
    22.         cells = GameObject.FindGameObjectsWithTag("AIpathCell");
    23.         doorsToCells = new int[cells.Length];
    24.         testForCells = true;
    25.         waitToTestCells = 2;
    26.         stage = 1;
    27.     }
    28.    
    29.     void Update ()
    30.     {  
    31.         if (testForCells && waitToTestCells <= 0)
    32.         {
    33.             foreach (GameObject imediateCell in imediateCells)
    34.             {
    35.                 for (int i = 0; i < cells.Length; i++)
    36.                 {
    37.                     if (cells[i] == imediateCell)
    38.                     {
    39.                         doorsToCells[i] = 1;
    40.                     }
    41.                 }
    42.             }
    43.            
    44.             for (stage = 2; stage <= cells.Length; stage++)
    45.             {
    46.                 for (int i = 0; i < cells.Length; i++)
    47.                 {
    48.                     if (doorsToCells[i] == stage - 1)
    49.                     {
    50.                         foreach (GameObject checkDoor in cells[i].GetComponent<AIpathCell>().doors)
    51.                         {
    52.                             if (checkDoor == gameObject)
    53.                             {
    54.                                 foreach (GameObject checkCell in checkDoor.GetComponent<AIpathDoorScript>().imediateCells)
    55.                                 {
    56.                                     for (int j = 0; j < cells.Length; j++)
    57.                                     {
    58.                                         if (cells[j] == checkCell && doorsToCells[j] == null)
    59.                                         {
    60.                                             doorsToCells[j] = stage;
    61.                                         }
    62.                                     }
    63.                                 }
    64.                             }
    65.                         }
    66.                     }
    67.                 }
    68.             }
    69.            
    70.             testForCells = false;
    71.             Debug.Log(doorsToCells);
    72.         }
    73.         waitToTestCells -= 1;
    74.     }
    75.    
    76.     void OnTriggerEnter (Collider other)
    77.     {
    78.         if (other.tag == "AIpathCell")
    79.         {
    80.             imediateCells.Add(other.gameObject);
    81.         }
    82.     }
    83. }
    84.  
     
  22. PrimitiveCreations

    PrimitiveCreations

    Joined:
    Apr 15, 2015
    Posts:
    10
  23. dottyfdsf

    dottyfdsf

    Joined:
    Oct 6, 2014
    Posts:
    2
    Hi everybody,

    I would like to build the Eteeski FPS on Android but I don't know how to setup the buttons with the scripts.
    How to make:
    1) Swipe the camera around with finger
    2) Basic movement with buttons on the screen (taping the buttons to go left, right etc.)
    3) Screen button for shooting bullets
    4) Screen button for aiming

    I will be really thanky if you help me how to do that and I promise I will Credit you when I upload the FPS game onto Google Play!
     
  24. DMW1024

    DMW1024

    Joined:
    Jun 6, 2015
    Posts:
    1
    In FPS 1.3
    my capsule wont move. i get this error and it says i should update the API


    'UnityEngine.Component.rigidbody' is obsolete. Property rigidbody has been deprecated. Use GetComponent<Rigidbody>() instead

    but then it updates it to

    GetComponent.<Rigidbody>().AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration);

    Is anyone else having this issue? neither of the scripts worked btw. the one in the video didnt work i copied it exactly and the updated version of it didnt either. ill post both scripts.

    BEFORE UPDATED API
    var walkAcceleration : float = 5;
    var cameraObject : GameObject;

    function Update ()
    {
    transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).currentYRotation, 0);
    rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration);
    }

    AFTER UPDATED API

    var walkAcceleration : float = 5;
    var cameraObject : GameObject;

    function Update ()
    {
    transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).currentYRotation, 0);
    GetComponent.<Rigidbody>().AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration);
    }


    if anyone else had this issue how did you fix it? any help is appreciated.
     
  25. Nizraan

    Nizraan

    Joined:
    Apr 1, 2014
    Posts:
    6
    when new API updated we can't directly add rigidbody. first create variable of rigidbody. now you can change every rigidbody using variable of rb. so code must change this type.

    var rb : Rigidbody;

    function Start()
    {
    rb = GetComponent.<Rigidbody>();
    }

    function Update ()
    {
    transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(MouseLookScript).currentYRotation, 0);
    rb.AddRelativeForce(Input.GetAxis("Horizontal") * walkAcceleration, 0, Input.GetAxis("Vertical") * walkAcceleration);
    }
     
  26. TreeMeansMe

    TreeMeansMe

    Joined:
    Jan 3, 2016
    Posts:
    1
    Whenever I walk with the preset FPS Controller or your PlayerMovement script, whenever i turn to go a different direction my controls don't turn ether. So if I go straight for a while using 'w', then i turn to the left, and instead of just being able to use 'w' to go forward I have to use 'd'. Do you know how i can fix this?
     
  27. xXx_JMA_Prods23_xXx

    xXx_JMA_Prods23_xXx

    Joined:
    Mar 1, 2016
    Posts:
    1
    Hello Eteeski, My player just flies around
     
  28. Kotauskas

    Kotauskas

    Joined:
    Mar 31, 2017
    Posts:
    1
    Hi. I have a question about FPS 1.7. You have added a Smooth Damper into the code so it's not that slippery now, but I don't understand these variables - when they are changed?
    Code (JavaScript):
    1. @HideInInspector
    2. var walkDeaccelerationVolx : float;
    3. @HideInInspector
    4. var walkDeaccelerationVolz : float;