⚠️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
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 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
@@Fallenblood yes Like. Apply Forward force And Change the direction by joystick // rotating player Like escap homing missile game mechanics Help me for this 🙏😢
@@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
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!☺️
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.
@@BOALA508 it's easy Just import standard assets then in script under using unityEngine add this Using standardasset.crossplatforminput; Then replace Input with CrossplatformInputManager
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
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)
Updated video - ua-cam.com/video/VR5y5E-WaUU/v-deo.html
Watch that instead of this
sir mai Dhanya ho gaya aapna chehARA DIKHANE KA KASHT KAREN
you are my hero
⚠️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
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"
@@CalebJustice created 2 float variables
float _z ;
float __z;
@@Fallenblood ok thanks
@@Fallenblood what about for z? it says "the name z doesn't exist in the current context"
thank you, its turned out to be surprisingly difficalt to find this script - top down movement with rigidbody (NOT 2d)
Just a little bit clear audio and this is one of the best video on this topic!
That's exactly what I was looking for, thank you
I changed the script to 3d (just changed to 3d rigdbody), but i cant change to keep rotation to 3d :S how?
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
1:00
I can't find your previous video about how to do this, on your channel..
Ah it's automatically deleted idk wht happened
thank you so much
can i ignore the fixed update method? because my characters doesnt has a rigidbody
Yes
@@Fallenblood Can you make a proper tutorial on how to make movement for tank using joystick.? Just like the game in tanktrouble.com
@@dreme6105 ok
@@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
Genius, thanks a lot bro
thank you this was helpful.
Glad it was helpful!
Hi I was watching your tutorial but still cant figure how to make player to shoot only with button?
Thanks!
How to the keep move Forward direction
I didn't understand completely 😅 plz explain
Like Player Move forward direction
Just use of joystick we turn is direction
@@mithilesh8385 did u mean that joystick will only responsible for rotating the player, not movement
@@Fallenblood yes
Like. Apply Forward force
And Change the direction by joystick // rotating player
Like escap homing missile game mechanics
Help me for this 🙏😢
@@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
How do you keep the rotation?
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!☺️
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.
@@playagainstudios1370 wait bro I will tell you as fast I found solution
Same problem
Help
Next time plz put the music a little lower plz : D
Thank you ❤️
You’re welcome 😊
My object is rotating properly but not at all moving forward.
How do I make a aiming joystick without a moving system?
How do I rotate an object according to the direction of the joystick?
just remove the rb.moveposition(); function.
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
Nice 👍👌
Thanks 😊
Even when i put (1) it's still not working, not even shooting.
Don't put that I use that I used only for demonstration
Use that
If(Input.GetButtunDown("Fire1"))
{
//Shoot
}
Btw you have press right mouse key
@@Fallenblood but i want to be an android game
@@Fallenblood and I want to shoot while i move
@@BOALA508 it's easy
Just import standard assets then in script under using unityEngine add this
Using standardasset.crossplatforminput;
Then replace Input with CrossplatformInputManager
I want to shoot when moving
For phones use this:
If(input.getmousebutton(0)){
//Shoot
}
@@Fallenblood when moving the player it shooting themselve
Im not good at english
@@Yond83 firepoint.up?
@@Yond83 solving problem in comment in not easy so I recommend you to join my discord server
discord.gg/fCstAH2
what is your age
I WANT TO SHOOT WHEN I MOVE PLEASE HELP ME!!! PUTTING 1 IT'S NOT WORKING
Salam
Mən Azərbaycanlıyam
How to keep the rotation
PlayerPrefs
@@BigPapochka12 do you know how to do that
@@KamyTheTraveler Yes
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
@@Fallenblood TERRIBLE
GameObject bulletClone -Instantiate(bullet, shootingPoint.position, shootingPoint.rotation);
error is ; expected
what did i done wrong
plz help
Actually you forget to put semicolon ';'
And put '=' after bulletClone
oh thank you
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
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)
@@Fallenblood thank you it was hard to see ur video because it is pixelated but thanks. I suggested changing video recorder
Ok bro
@@Fallenblood i have question. How to not make player rotate?
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?
just fix the audio, and you'll be great
Ok brother!!