Excellent tutorial dude...this is the only thing I was trying to find for my new game ... actually wanted touch drag for a bow and arrow ...but this works fine 🔥
sick bro! thank you, however, i am having problems with unity remote 5, i am not asking for a solution, i just want to know if it is necesery to go and test the game from my phone, the drag and shoot is the only function needed for my game from my phone and i trust ur sollution, and i know the ui works for touch anyways soo this is guarenteed right?
Unity Remote 5 is only one way to test, another way is to build the game straight to a device then you can see if it works for you but you can implement both Touch and Mouse controls to test it on your machine if you can't test on an actual device right now... I hope that helps!
Hello, how could I make an impulse counter or the number of times I execute. I was trying to put a counter +=1; and add too many instead of one at a time and more if you're pressed please help
Is there any way to make line renderer length limit ? line renderer endPos follow mouse position but line length goes infinite want line length limited.
Great video! Not sure if it's just me since I haven't used unity or coded in a bit but I can't get directional animations working with this. Has anyone else done this?
you could probably make a parent script and have it check if the velocity does not exceed a certain number and if it does make it so you can't do anything but once it is lower than that assigned number it will be able to be shot. P.S. I am new to coding and so this may not be the best way to do it
great it sounds and it makes a lot of sense I'm new to this anyway and I spent all day trying to deactivate the touch hahaha and you fixed it for me over the weekend I just have to find out how you determined the speed to be able to manipulate the values with an if
You would need to add in some inertia or drag to your game object, you could do it so if you hit an object you lose momentum but it all depends on what you're trying to achieve...
@@MuddyWolf if(rb.velocity!=Vector2.zero){ rb.velocity -= rb.velocity * Time.deltaTime; } I'm still learning and i added this to the update thank you for the tutorial :)
i think you go about it using *bool IsGrounded* if the player is grounded then you enable the drag control to shoot the player and if not then you cant
Did you enjoy this mobile tutorial? Should I do more?
If u do i'll definitely give another subscribe smash !
Yessss
Yes it's very very helpful
Can you show us how to display a power meter for this. It would be really helpful.
I most certainly did !
public float power = 10f;
public float maxDrag = 5f;
public Rigidbody2D rb;
public LineRenderer lr;
Vector3 dragStartPos;
Touch touch;
private void Update()
{
if(Input.touchCount > 0)
{
touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
DragStart();
}
if (touch.phase == TouchPhase.Moved)
{
Dragging();
}
if (touch.phase == TouchPhase.Ended)
{
DragRealease();
}
}
}
private void DragStart()
{
dragStartPos = Camera.main.ScreenToWorldPoint(touch.position);
dragStartPos.z = 0f;
lr.positionCount = 1;
lr.SetPosition(0, dragStartPos);
}
private void Dragging()
{
Vector3 draggingPos = Camera.main.ScreenToWorldPoint(touch.position);
dragStartPos.z = 0f;
lr.positionCount = 2;
lr.SetPosition(1, draggingPos);
}
private void DragRealease()
{
lr.positionCount = 0;
Vector3 dragReleasePos = Camera.main.ScreenToWorldPoint(touch.position);
dragStartPos.z = 0f;
Vector3 force = dragStartPos - dragReleasePos;
Vector3 clampedForce = Vector3.ClampMagnitude(force, maxDrag) * power;
rb.AddForce(clampedForce, ForceMode2D.Impulse);
}
Thank you! :D
R u sirieus
livesaver
Dude! Really good job! This is the only video i found about this. Thank you for reading comments and for being aware of what people needs!
Always! What's the point of teaching if I teach things people don't want to learn!
i love how you are still uploading videos
becauz i saw many youtuber who upload some videos and then dont upload any like myself gg
Was thinking about this and your video magicly poped up
I am a wizard
Wonderful video man! Can't wait to see more content 🧐🧐
Thanks Reece!! :D
I want to do this in 3D, but I cant find anything! Any help?
Bro really you deserve more subscribers and views than you're getting, Keep up the good work
thank you for this tutorial, was in need of this. keep up the good work!
Thanks for the tutorial, very well explained, nice & clear ! subscribed now.
Awesome, thank you!
This video has really helped out. Thanks a lot!
Excellent tutorial dude...this is the only thing I was trying to find for my new game ... actually wanted touch drag for a bow and arrow ...but this works fine 🔥
Glad I could help!
my man defined gravity with this code and i cant find out why
Thanks you!!!!! A Video that explains it clearly and makes it simple ;D
Thanks for the video! Really helpful
Nice tutorial Lots of fun!
And also please add a tutorial where it shows where the ball will be going (a trajectory line tutorial)
Please make a tutorial where the more power it is going to be added to the ball, the color of the line would change
my man got a google pixel 3. i respect google pixel users
#TeamPixel
FYI just upgraded to the 4 xD I'm always behind
@@MuddyWolf im on the pixel 5
Really Helpful Tutorial ! THank U!
Can you do it for 3d game? It is harder
also wondering this
How do you set line renderer on circle to have as a trajectory line
Have you found the solution to this?
Awesome video. Keep it up!!!
Thanks! Will do!
how is it inverted? I like the style but I want it to be the other way around when dragging the finger from the direction of the ball
Hey awesome tutorial. I have just 1 doubt, we can control power by clampMagnitude, how do I control the line renderer? Thank you
If I remember you just need to clamp the last line position to a magnitude of the distance too e.g. (end_pos - start_pos).magnitude and then clamp it
@@MuddyWolf got it :) thank you.
Thanks a lot!
You're welcome!
sick bro! thank you, however, i am having problems with unity remote 5, i am not asking for a solution, i just want to know if it is necesery to go and test the game from my phone, the drag and shoot is the only function needed for my game from my phone and i trust ur sollution, and i know the ui works for touch anyways soo this is guarenteed right?
Unity Remote 5 is only one way to test, another way is to build the game straight to a device then you can see if it works for you but you can implement both Touch and Mouse controls to test it on your machine if you can't test on an actual device right now... I hope that helps!
@@MuddyWolf it did help thanks!
Great Tutorial! :D
Hello, how could I make an impulse counter or the number of times I execute. I was trying to put a counter +=1; and add too many instead of one at a time and more if you're pressed please help
Is there any way to make line renderer length limit ?
line renderer endPos follow mouse position but line length goes infinite want line length limited.
Great video! Not sure if it's just me since I haven't used unity or coded in a bit but I can't get directional animations working with this. Has anyone else done this?
Thank you! I might make a video in the near future on directional animations :)
how i can limit it.
I Just Smashed That Fuc*ing Subscribe Button !
is there a way to lock the controls to only one half of the screen?
good video bro! thanks for sharing
Thanks for the visit
how do i make it that the line only starts if you drag the ball and not just anywhere on the screen?
good vid bro thanks
Can you show us how to display a power meter for this?
How do I attach the line to the ball so no matter where a touch,it looks like i started from the ball
hello could you please help me it is saying my RigidBody2D namespace could not be found
Great job ! but I want the darg beginning when I touch the ball only ,not everywhere on the screen, could any one help me in the code
Is there any way you can tell me how to only be able to drag and shoot my ball when its on the ground and not in the air?
You can do a check for "IsGrounded" and use something like a raycast or overlap circle to test if it is on the ground.
@@MuddyWolf Could You please do a video on that :)
How do i make the line renderer always start in the ball? *like in angry birds*
can i have a template download.... I did all the progress for it to fail =(
p.s. make sure your script is named 'BallControl' for it to work
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BallControl : MonoBehaviour
{
public float power = 10f;
public float maxDrag = 5f;
public Rigidbody2D rb;
public LineRenderer lr;
Vector3 dragStartpos;
Touch touch;
private void Update()
{
if (Input.touchCount > 0)
{
touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
DragStart();
}
if (touch.phase == TouchPhase.Moved)
{
Dragging();
}
if (touch.phase == TouchPhase.Ended)
{
DragRelease();
}
}
}
void DragStart()
{
dragStartpos = Camera.main.ScreenToWorldPoint(touch.position);
dragStartpos.z = 0f;
lr.positionCount = 1;
lr.SetPosition(0, dragStartpos);
}
void Dragging()
{
Vector3 draggingPos = Camera.main.ScreenToWorldPoint(touch.position);
draggingPos.z = 0f;
lr.positionCount = 2;
lr.SetPosition(1, draggingPos);
}
void DragRelease()
{
lr.positionCount = 0;
Vector3 dragReleasePos = Camera.main.ScreenToWorldPoint(touch.position);
dragReleasePos.z = 0f;
Vector3 force = dragStartpos - dragReleasePos;
Vector3 clampedForce = Vector3.ClampMagnitude(force, maxDrag) * power;
rb.AddForce(clampedForce, ForceMode2D.Impulse);
}
}
Hey can you send a link to download the script
need more videos=)
More coming;
Can you do a tutorial on how to do this, but make it so that the ball can only be shot once until it comes to a complete stop?
you could probably make a parent script and have it check if the velocity does not exceed a certain number and if it does make it so you can't do anything but once it is lower than that assigned number it will be able to be shot. P.S. I am new to coding and so this may not be the best way to do it
great it sounds and it makes a lot of sense I'm new to this anyway and I spent all day trying to deactivate the touch hahaha and you fixed it for me over the weekend I just have to find out how you determined the speed to be able to manipulate the values with an if
how do i stop the object im on top down view i dont have a gravity
You would need to add in some inertia or drag to your game object, you could do it so if you hit an object you lose momentum but it all depends on what you're trying to achieve...
@@MuddyWolf
if(rb.velocity!=Vector2.zero){
rb.velocity -= rb.velocity * Time.deltaTime;
}
I'm still learning and i added this to the update thank you for the tutorial :)
Hello, is there a way to be able to shoot the ball only when it's completely stopped?
or just what is the code line to make script work only if player is in asleep state?
I need this but for Unreal Engine dose anyone know any good videos that would help?
Unity is giving me an "ArgumentOutOfRangeException" error and I cant seem to figure it out. May I get some help please?
Wat line ? On the script?
how do i make this in 3d?
Please, plese provide a sample scene of the game or a repository... Please
How do make it so that if my player is in the air or flying, that I can't shoot again, but if the player is grounded you can?
i think you go about it using *bool IsGrounded* if the player is grounded then you enable the drag control to shoot the player and if not then you cant
*for the lazy one's* using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BallControl : MonoBehaviour
{
public float power = 10f;
public float maxDrag = 5f;
public Rigidbody2D rb;
public LineRenderer lr;
Vector3 dragStartPos;
Touch touch;
private void Update()
{
if (Input.touchCount > 0)
{
touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
DragStart();
}
if (touch.phase == TouchPhase.Moved)
{
Dragging();
}
if (touch.phase == TouchPhase.Ended)
{
DragRelease();
}
}
}
void DragStart()
{
dragStartPos = Camera.main.ScreenToWorldPoint(touch.position);
dragStartPos.z = 0f;
lr.positionCount = 1;
lr.SetPosition(0, dragStartPos);
}
void Dragging()
{
Vector3 draggingPos = Camera.main.ScreenToWorldPoint(touch.position);
draggingPos.z = 0f;
lr.positionCount = 2;
lr.SetPosition(1, draggingPos);
}
void DragRelease()
{
lr.positionCount = 0;
Vector3 dragReleasePos = Camera.main.ScreenToWorldPoint(touch.position);
dragReleasePos.z = 0f;
Vector3 force = dragStartPos - dragReleasePos;
Vector3 clampedForce = Vector3.ClampMagnitude(force, maxDrag) * power;
rb.AddForce(clampedForce, ForceMode2D.Impulse);
}
}
For anyone trying to implement this into a 3D mobile game
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProjectileControl : MonoBehaviour
{
public float power = 10f;
public float maxDrag = 5f;
public Rigidbody rb;
public LineRenderer lr;
Vector3 dragStartPos;
Vector3 dragReleasePos;
private void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
switch (touch.phase)
{
case TouchPhase.Began:
DragStart(touch.position);
break;
case TouchPhase.Moved:
Dragging(touch.position);
break;
case TouchPhase.Ended:
DragRelease(touch.position);
break;
}
}
}
void DragStart(Vector2 screenPos)
{
dragStartPos = GetWorldPosWithZ(screenPos, 0f);
lr.positionCount = 1;
lr.SetPosition(0, dragStartPos);
}
void Dragging(Vector2 screenPos)
{
Vector3 draggingPos = GetWorldPosWithZ(screenPos, 0f);
lr.positionCount = 2;
lr.SetPosition(1, draggingPos);
}
void DragRelease(Vector2 screenPos)
{
lr.positionCount = 0;
dragReleasePos = GetWorldPosWithZ(screenPos, 0f);
Vector3 force = dragStartPos - dragReleasePos;
Vector3 clampedForce = Vector3.ClampMagnitude(force, maxDrag) * power;
rb.AddForce(clampedForce, ForceMode.Impulse);
}
Vector3 GetWorldPosWithZ(Vector2 screenPos, float z)
{
Vector3 worldPos = Camera.main.ScreenToWorldPoint(new Vector3(screenPos.x, screenPos.y, Mathf.Abs(Camera.main.transform.position.z)));
worldPos.z = z;
return worldPos;
}
}
Can you make how to shoot bullets with touch control
Or with a fire button
Vector3 does not contain a definition for ClampedMagnitude
Clamp, not Clamped
Plsss can you show mr how to make push to shot in unity 2d like in game "Balls?"
Pfft
HAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAAHAHHAAHHAAHHAHAAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHAHHAAHHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHHAHAAHAHHAAHAHHAHAHAHAHAHAHHAHAHAHHAHAHAHAHAHAHAHAHAHHAHAHAHHAHAHAHAHAHAHHAHAHAHAHAHHAHAHAHAAHHAHHHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHHAHAAHAHAHHAHAHAHAAHHAHAHAHAHAHHAHAHAHAHAHAHAHHAH HAHAHAHAHAHAHAHA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AHAHAHAHAHHAHAAHAHHAAHAHHAHAHAHAHAHAHHAHAHAHHAHAHAHAHAHAHAHAHAHHAHAHAHHAHAHAHAHAHAHHAHAHAHAHAHHAHAHAHAAHHAHHHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHHAHAAHAHAHHAHAHAHAAHHAHAHAHAHAHHAHAHAHAHAHAHAHHAHHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAAHAHHAAHHAAHHAHAAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHAHHAAHHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHHAHAAHAHHAAHAHHAHAHAHAHAHAHHAHAHAHHAHAHAHAHAHAHAHAHAHHAHAHAHHAHAHAHAHAHAHHAHAHAHAHAHHAHAHAHAAHHAHHHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHHAHAAHAHAHHAHAHAHAAHHAHAHAHAHAHHAHAHAHAHAHAHAHHAH
@@frenchfried6179 Are you okay?
work in pc
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BallControl : MonoBehaviour
{
public float power = 10f;
public float maxDrag = 5f;
public Rigidbody2D rb;
public LineRenderer lr;
Vector3 dragStartpos;
Touch touch;
private void Update()
{
if (Input.touchCount > 0)
{
touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
DragStart();
}
if (touch.phase == TouchPhase.Moved)
{
Dragging();
}
if (touch.phase == TouchPhase.Ended)
{
DragRelease();
}
}
}
void DragStart()
{
dragStartpos = Camera.main.ScreenToWorldPoint(touch.position);
dragStartpos.z = 0f;
lr.positionCount = 1;
lr.SetPosition(0, dragStartpos);
}
void Dragging()
{
Vector3 draggingPos = Camera.main.ScreenToWorldPoint(touch.position);
draggingPos.z = 0f;
lr.positionCount = 2;
lr.SetPosition(1, draggingPos);
}
void DragRelease()
{
lr.positionCount = 0;
Vector3 dragReleasePos = Camera.main.ScreenToWorldPoint(touch.position);
dragReleasePos.z = 0f;
Vector3 force = dragStartpos - dragReleasePos;
Vector3 clampedForce = Vector3.ClampMagnitude(force, maxDrag) * power;
rb.AddForce(clampedForce, ForceMode2D.Impulse);
}
}
your name is Taliban?
first
Ooof that's a flex!
@@MuddyWolf well i have notifications on
Wooo!
please give me source code
OMG! That‘s what I need! Thanks for your help /(ㄒoㄒ)/~~ !
SCRIPT DOWNLOAD PLEASEEEEEEEEEEEEEE