TOP DOWN SHOOTING - JOYSTICK CONTROL FOR MOBILE!UNITY TUTORIAL

Поділитися
Вставка
  • Опубліковано 29 жов 2024

КОМЕНТАРІ • 123

  • @Fallenblood
    @Fallenblood  2 роки тому +1

    Updated video - ua-cam.com/video/VR5y5E-WaUU/v-deo.html
    Watch that instead of this

  • @sarvesh4150
    @sarvesh4150 3 роки тому +1

    sir mai Dhanya ho gaya aapna chehARA DIKHANE KA KASHT KAREN

  • @Ayyouboss
    @Ayyouboss 2 роки тому +1

    you are my hero

  • @Fallenblood
    @Fallenblood  4 роки тому +2

    ⚠️Stop watching this⚠️
    Check updated video on this-ua-cam.com/video/VR5y5E-WaUU/v-deo.html
    Ok , I know why are u here in comments property for rotation
    Listen up this method is outdated and also sucks so uploaded new video on this with new inputs system
    Check it -ua-cam.com/video/VR5y5E-WaUU/v-deo.html
    ua-cam.com/video/VR5y5E-WaUU/v-deo.html
    Stop watch this and go to update video on Joystick - ua-cam.com/video/VR5y5E-WaUU/v-deo.html

    • @CalebJustice
      @CalebJustice 4 роки тому +1

      it still doesnt work i get the error "The name '_z' doesn't exist in the current context"
      and "The name '__z' doesn't exist in the current context"
      and also "The name 'z' doesn't exist in the current context"

    • @Fallenblood
      @Fallenblood  4 роки тому

      @@CalebJustice created 2 float variables

    • @Fallenblood
      @Fallenblood  4 роки тому

      float _z ;
      float __z;

    • @CalebJustice
      @CalebJustice 4 роки тому

      @@Fallenblood ok thanks

    • @CalebJustice
      @CalebJustice 4 роки тому

      @@Fallenblood what about for z? it says "the name z doesn't exist in the current context"

  • @kostyayeremenko7904
    @kostyayeremenko7904 4 роки тому +1

    thank you, its turned out to be surprisingly difficalt to find this script - top down movement with rigidbody (NOT 2d)

  • @Zihan118
    @Zihan118 4 роки тому +2

    Just a little bit clear audio and this is one of the best video on this topic!

  • @mouaadhachani4457
    @mouaadhachani4457 3 роки тому

    That's exactly what I was looking for, thank you

  • @kioka2
    @kioka2 3 роки тому +1

    I changed the script to 3d (just changed to 3d rigdbody), but i cant change to keep rotation to 3d :S how?

    • @Fallenblood
      @Fallenblood  3 роки тому

      In 2d you need to rotate the player on z axis but in 3D you need to rotate it on y axis if it is top down

  • @ArravTwitch
    @ArravTwitch 3 роки тому +2

    1:00
    I can't find your previous video about how to do this, on your channel..

    • @Fallenblood
      @Fallenblood  3 роки тому +1

      Ah it's automatically deleted idk wht happened

  • @untemi4045
    @untemi4045 3 роки тому +2

    thank you so much

  • @dreme6105
    @dreme6105 4 роки тому +1

    can i ignore the fixed update method? because my characters doesnt has a rigidbody

    • @Fallenblood
      @Fallenblood  4 роки тому

      Yes

    • @dreme6105
      @dreme6105 4 роки тому +1

      @@Fallenblood Can you make a proper tutorial on how to make movement for tank using joystick.? Just like the game in tanktrouble.com

    • @Fallenblood
      @Fallenblood  4 роки тому

      @@dreme6105 ok

    • @dreme6105
      @dreme6105 4 роки тому +1

      @@Fallenblood Thanks a lot man. Really. I really appreciate it a lot. Also just include to shoot a bullet. You can get beautiful tank assets for free from kenney.com

  • @DheyssonSS
    @DheyssonSS 3 роки тому

    Genius, thanks a lot bro

  • @Cenk_1903
    @Cenk_1903 4 роки тому

    thank you this was helpful.

  • @playzy8186
    @playzy8186 3 роки тому

    Hi I was watching your tutorial but still cant figure how to make player to shoot only with button?

  • @great8814
    @great8814 3 роки тому

    Thanks!

  • @mithilesh8385
    @mithilesh8385 3 роки тому +1

    How to the keep move Forward direction

    • @Fallenblood
      @Fallenblood  3 роки тому +1

      I didn't understand completely 😅 plz explain

    • @mithilesh8385
      @mithilesh8385 3 роки тому +1

      Like Player Move forward direction
      Just use of joystick we turn is direction

    • @Fallenblood
      @Fallenblood  3 роки тому +1

      @@mithilesh8385 did u mean that joystick will only responsible for rotating the player, not movement

    • @mithilesh8385
      @mithilesh8385 3 роки тому +1

      @@Fallenblood yes
      Like. Apply Forward force
      And Change the direction by joystick // rotating player
      Like escap homing missile game mechanics
      Help me for this 🙏😢

    • @Fallenblood
      @Fallenblood  3 роки тому +1

      @@mithilesh8385 u need to keep on thing in mind that what is default rotation of player
      In which direction he is facing at 0 degree Normally in unity it's upward which is postive y axis
      U need to Change the position of ur player
      By this rigidbody.position+=transform.up*speed*time.fixedDeltatime;
      transform.up is a local y axis value

  • @playagainstudios1370
    @playagainstudios1370 4 роки тому +2

    How do you keep the rotation?

    • @Fallenblood
      @Fallenblood  4 роки тому +2

      I move and rotate the player with joystick.
      To rotate with joystick
      I take some float value from joystick position in both axis then I use Atan to calculate the angle for z axis then I apply the angle to player to rotate.
      To shoot you can use button
      Hope you understand!
      😀😀
      If you still any problem you can ask me freely!😊
      Hope you like my video
      And please subscribe so you can't miss you upcoming video!☺️

    • @playagainstudios1370
      @playagainstudios1370 4 роки тому +1

      when you let go of the joystick the rotation goes to back to 0, how would I do it so if I'm facing right and let go I will be still facing right? I hope i've explained myself okay.

    • @sumitkushwaha3607
      @sumitkushwaha3607 4 роки тому +3

      @@playagainstudios1370 wait bro I will tell you as fast I found solution

    • @Gajala-CEO-SonicSolutions
      @Gajala-CEO-SonicSolutions 4 роки тому +1

      Same problem

    • @Gajala-CEO-SonicSolutions
      @Gajala-CEO-SonicSolutions 4 роки тому +1

      Help

  • @ziasher4190
    @ziasher4190 3 роки тому +3

    Next time plz put the music a little lower plz : D

  • @enricocotugno9774
    @enricocotugno9774 3 роки тому

    Thank you ❤️

  • @dreme6105
    @dreme6105 4 роки тому

    My object is rotating properly but not at all moving forward.

  • @umeicrazy9567
    @umeicrazy9567 3 роки тому

    How do I make a aiming joystick without a moving system?

    • @umeicrazy9567
      @umeicrazy9567 3 роки тому

      How do I rotate an object according to the direction of the joystick?

    • @saravanan3080
      @saravanan3080 2 роки тому +1

      just remove the rb.moveposition(); function.

  • @ivangrigorev9129
    @ivangrigorev9129 3 роки тому

    My variant for keep last rotation:
    public float speed;
    public Joystick joystick;
    Rigidbody2D rb;
    Vector2 move;
    float lastZAxis;
    private void Start()
    {
    rb = GetComponent();
    }
    private void Update()
    {
    move.x = joystick.Horizontal;
    move.y = joystick.Vertical;
    float xAxis = joystick.Horizontal;
    float yAxis = joystick.Vertical;
    float zAxis = Mathf.Atan2(xAxis, yAxis) * Mathf.Rad2Deg;
    if (zAxis > 0 || zAxis

  • @borntohtml
    @borntohtml 4 роки тому +2

    Nice 👍👌

  • @BOALA508
    @BOALA508 4 роки тому +1

    Even when i put (1) it's still not working, not even shooting.

    • @Fallenblood
      @Fallenblood  4 роки тому +2

      Don't put that I use that I used only for demonstration
      Use that
      If(Input.GetButtunDown("Fire1"))
      {
      //Shoot
      }

    • @Fallenblood
      @Fallenblood  4 роки тому +1

      Btw you have press right mouse key

    • @BOALA508
      @BOALA508 4 роки тому +1

      @@Fallenblood but i want to be an android game

    • @BOALA508
      @BOALA508 4 роки тому +1

      @@Fallenblood and I want to shoot while i move

    • @Fallenblood
      @Fallenblood  4 роки тому +1

      @@BOALA508 it's easy
      Just import standard assets then in script under using unityEngine add this
      Using standardasset.crossplatforminput;
      Then replace Input with CrossplatformInputManager

  • @Yond83
    @Yond83 4 роки тому +2

    I want to shoot when moving

    • @Fallenblood
      @Fallenblood  4 роки тому +1

      For phones use this:
      If(input.getmousebutton(0)){
      //Shoot
      }

    • @Yond83
      @Yond83 4 роки тому

      @@Fallenblood when moving the player it shooting themselve

    • @Yond83
      @Yond83 4 роки тому

      Im not good at english

    • @Fallenblood
      @Fallenblood  4 роки тому

      @@Yond83 firepoint.up?

    • @Fallenblood
      @Fallenblood  4 роки тому

      @@Yond83 solving problem in comment in not easy so I recommend you to join my discord server
      discord.gg/fCstAH2

  • @pha3row232
    @pha3row232 4 роки тому +2

    what is your age

  • @BOALA508
    @BOALA508 4 роки тому

    I WANT TO SHOOT WHEN I MOVE PLEASE HELP ME!!! PUTTING 1 IT'S NOT WORKING

  • @Gajala-CEO-SonicSolutions
    @Gajala-CEO-SonicSolutions 4 роки тому +1

    How to keep the rotation

    • @BigPapochka12
      @BigPapochka12 4 роки тому +1

      PlayerPrefs

    • @KamyTheTraveler
      @KamyTheTraveler 4 роки тому

      @@BigPapochka12 do you know how to do that

    • @BigPapochka12
      @BigPapochka12 4 роки тому

      @@KamyTheTraveler Yes

    • @Fallenblood
      @Fallenblood  4 роки тому +2

      just add this line in update method
      if (z != 0)
      {
      _z = z;
      __z = z;
      }
      if (z == 0)
      {
      _z = __z;
      }
      then add in fixed Update
      add this
      rb.rotation = _z;
      remove the" transform.eulerangel" line
      if you not get get desire reults try to change the sign(like "-" "+")
      still have problem -- discord.gg/mtZkmWF

    • @BigPapochka12
      @BigPapochka12 4 роки тому

      @@Fallenblood TERRIBLE

  • @pha3row232
    @pha3row232 4 роки тому +2

    GameObject bulletClone -Instantiate(bullet, shootingPoint.position, shootingPoint.rotation);
    error is ; expected
    what did i done wrong
    plz help

    • @Fallenblood
      @Fallenblood  4 роки тому +1

      Actually you forget to put semicolon ';'

    • @Fallenblood
      @Fallenblood  4 роки тому +1

      And put '=' after bulletClone

    • @pha3row232
      @pha3row232 4 роки тому +1

      oh thank you

  • @numwit
    @numwit 4 роки тому +2

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PlayerMovement : MonoBehaviour
    {
    public float speed;
    public Joystick joystick;
    Vector2 move;
    public Rigidbody2D rb;
    void Update()
    {
    move.x - joystick.Horizontal;
    move.y - joystick.Vertical;
    float hAxis = joystick.Horizontal;
    float vAxis = joystick.Vertical;
    float zAxis = Mathf.Atan2(hAxis, vAxis) * Mathf.Rad2Deg;
    transform.eulerAngles = new Vector3(0, 0, -zAxis);
    }
    private void FixedUpdate()
    {
    rb.MovePosition(rb.position + move * speed * Time.fixedDeltaTime);
    }
    }
    Help? unity tells me only assignment etc can be statement

    • @Fallenblood
      @Fallenblood  4 роки тому +2

      You make small mistake at line 13 and line 14.
      Correct:-
      move.x=joystick.Horizontal;
      move.y=joystick.Vertical;
      Wrong:-
      move.x-joystick.Horizontal;
      move.y-joystick.Vertical:
      You put '-' after move.x and move.y
      This means that line going subtract move(vector) from joystick.horizontal or vertical
      Put '=' equal to mark.
      You need to store the value of joystick into move(vector)

    • @numwit
      @numwit 4 роки тому +1

      @@Fallenblood thank you it was hard to see ur video because it is pixelated but thanks. I suggested changing video recorder

    • @Fallenblood
      @Fallenblood  4 роки тому +1

      Ok bro

    • @numwit
      @numwit 4 роки тому +1

      @@Fallenblood i have question. How to not make player rotate?

    • @numwit
      @numwit 4 роки тому +1

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerMovement : MonoBehaviour
      {
      public float speed;
      public Joystick joystick;
      Vector2 move;
      public Rigidbody2D rb;
      void Update()
      {
      move.x = joystick.Horizontal;
      move.y = joystick.Vertical;
      float hAxis = joystick.Horizontal;
      float vAxis = joystick.Vertical;
      float zAxis = Mathf.Atan2(hAxis, vAxis) * Mathf.Rad2Deg;
      transform.eulerAngles = new Vector3(0, 0, -zAxis);
      }
      private void FixedUpdate()
      {
      rb.MovePosition(rb.position + move * speed * Time.fixedDeltaTime);
      }
      }
      what should I change here?

  • @ozren71
    @ozren71 3 роки тому

    just fix the audio, and you'll be great