@@MuddyWolf I am getting ready for Ludum Dare 46 this 17th of April.....hope you will be also joining (in case if you don't know what is ludum dare, it is one of the world's largest game jams search google for more info)
@@Luckysury333 I am this will be the first one I join. To be honest I'm not the best at game Dev! I'm trying to get better but practicing then showing off what I learn in a tutorials for others!
On dragging it actually control the ball throwing force like( if mouse dragging length is short the force applied on the ball is low competitive the longer drag).
Amazing.👌 I was using it for a touch-controlled game and change a few things in there. but anyway the Explanations were really good(others won't say which code is doing what or what is this line of code we are writing is for. I mean we learn it as you do it cause u explain everything, and we are not just copying everything you type without being able to configure it for our own game later or understand it. tnx a Lot.😊
thanks, man this video was awesome, slowly and good explained, you spoke clearly, and I could understand every word, unity tutorials should always be like this subbed :)
Didn't use the whole tutorial, but was definitely very useful with working out how the line renderer works! Looking forward to watching more of your videos :)
@muddywolfgames awesome tutorial. have just one doubt ,,,, how do i show the power when the player interacts with game. i mean at the start of the video 0:10 i can see there is a power at the top centre, how can i achieve this?
I've got error at 21:26 : There is no argument given that corresponds to the required formal parameter 'position' of 'LineRenderer.SetPosition(int, Vector3)'
Hello! Thank you very much for the tutorial! I'm having issues when I set the camera to perspective mode. It only works correctly if it's in orthographic mode. Has anyone else experienced this? How can I solve it?
so i was wondering, how do you make it so you can only use it a certain amount of times when you are in the air and when you touch the ground it resets?
hello,how can i make the line follow the camera? so,i am making the game where the camera follow the gameobject..when ever i try and draw the line ,the startpoint moves off the camera and i dont want this to happen...i want to follow the camera like ur game which shows at beggining ..please help
If you want to make it so you can only drag when the object is still, Then the DragNShoot script will be this: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { public float power = 10f; public Rigidbody2D rb; public Vector2 minPower; public Vector2 maxPower; TragectoryLine tl; Camera cam; Vector2 force; Vector3 startPoint; Vector3 endPoint; bool isStill = true; private void Start() { cam = Camera.main; tl = GetComponent(); } private void Update() { if (rb.velocity == new Vector2(0, 0)) { isStill = true; } else { isStill = false; } if (Input.GetMouseButtonDown(0) && isStill == true) { startPoint = cam.ScreenToWorldPoint(Input.mousePosition); startPoint.z = 15; } if (Input.GetMouseButton(0) && isStill == true) { Vector3 currentPoint = cam.ScreenToWorldPoint(Input.mousePosition); currentPoint.z = 15; tl.RenderLine(startPoint, currentPoint); } if (Input.GetMouseButtonUp(0) && isStill == true) { endPoint = cam.ScreenToWorldPoint(Input.mousePosition); endPoint.z = 15; force = new Vector2(Mathf.Clamp(startPoint.x - endPoint.x, minPower.x, maxPower.x), Mathf.Clamp(startPoint.y - endPoint.y, minPower.y, maxPower.y)); rb.AddForce(force * power, ForceMode2D.Impulse); tl.EndLine();
} } } Here I created a bolean called "isStill". And in the void Update() I made isStill = true if the velocity of the rigid body is = new Vector2(0, 0) And if its not (else), then isStill = false. And then for each if statement we made I added (&& isStill ==true) to make sure the object is still to be able to perform this action
idk if you are gonna respond to this because it's been 2 years sience you made this video but the tutorial is great i just have an issue with it: the players can spam it and they can fly so how do i make like a cooldown system or that if the player stops moving then they can move again or something?
So what I did was create a boolean variable to track whether the player has used their drag and shoot ability or not. I wanted the player to have one chance to use the drag and shoot function and thats it. And when the player respawns it re-enables it. bool hasShot = false; if (Input.GetMouseButton(0) && !hasShot) if (Input.GetMouseButtonUp(0) && !hasShot) { hasShot = true; } Then, in my respawn Coroutine I just added hasShot = false; so for you, I would recommend doing like a Coroutine WaitForSeconds and then setting the boolean variable back to false or something of that nature.
Great Tutorial! But unfortunetly it didn't work for me but you know it's okay, It was good explaining and atleast i learned alot with input, Thank you!
Followed the video and on finish the line renderer seems like it's attached to the ball object, so when i drag it spawns the line next to the ball rather than where I click. Did I miscode it or miss box tick in a menu or something? Either way awesome video :) thanks for putting it out
I just don't understand what's the first parameter in the Mathf.Clamp( ) function and I don't get the use of it. Otherwise, everything else is clear. Thank You!
Dummy question here: I have a ball with 9 child bones( to create the soft body effect). Initially, the script applied only to the rigid body "Ball" had no effect, so I've added the same script also to each bone and it works perfectly. With that said, is there another way of doing it? Not sure if that's the most lean way. Thanks
everyone i know im late to the party but i need help i followed everything but unity says "The type or namespace name 'TrajectoryLine' could not be found (are you missing a using directive or an assembly reference?)" pls help me ive been stuck for two days !
When I try to add another line renderer for my player to make it so it has a trail while its moving and its not working. Does anyone know how to fix this?
i want to add cooldown for this shooting thing. please answer and tell us how we can add cooldown for this game please Cheers -your lovely followers :)
There's 2 ways you can do this! Either a by using coroutine function or by setting a boolean and setting it true after a timer, I would recommend looking into coroutines!
@@MuddyWolf i didnt understand that how can i do cooldown with using coroutine system. Can you show me one video that shows how can i add cooldown to my game using coroutine system please? I tried a lot of tutorials but they didnt work.
Hey man, I've really liked your tutorial and it helped me a lot; but can you help me with something? After I added animation to the script the ball only jumps straight in the air, it doesn't jump on the right or left part, do you know any solution for this? Thanks in advance!
Hey excellent video but I have a question How do you get the autocomplete and definition thing for unity because when I type it doesn't show all the options you have
I have a problem with the code:( Unity says no errors but when i just click without dragging it applys velocity on the y axis:( Can you/someone please help.
Just wondering, how would I go about setting the start point to an object e.g. the ball instead of a camera point? So that my drag starts from the object, thanks so much! Great tutorial
thank you so much for the tutorial, I'm trying to make the line renderer start from ball instead of my mouse point when i drag anywhere of the screen and the line will expand the opposite way, can you pls advice.
There is a setting on the line renderer component that says use world space, if you uncheck this the line will draw from the game object! I hope this helps!
Then the DragNShoot script will be this: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { public float power = 10f; public Rigidbody2D rb; public Vector2 minPower; public Vector2 maxPower; TragectoryLine tl; Camera cam; Vector2 force; Vector3 startPoint; Vector3 endPoint; bool isStill = true; private void Start() { cam = Camera.main; tl = GetComponent(); } private void Update() { if (rb.velocity == new Vector2(0, 0)) { isStill = true; } else { isStill = false; } if (Input.GetMouseButtonDown(0) && isStill == true) { startPoint = cam.ScreenToWorldPoint(Input.mousePosition); startPoint.z = 15; } if (Input.GetMouseButton(0) && isStill == true) { Vector3 currentPoint = cam.ScreenToWorldPoint(Input.mousePosition); currentPoint.z = 15; tl.RenderLine(startPoint, currentPoint); } if (Input.GetMouseButtonUp(0) && isStill == true) { endPoint = cam.ScreenToWorldPoint(Input.mousePosition); endPoint.z = 15; force = new Vector2(Mathf.Clamp(startPoint.x - endPoint.x, minPower.x, maxPower.x), Mathf.Clamp(startPoint.y - endPoint.y, minPower.y, maxPower.y)); rb.AddForce(force * power, ForceMode2D.Impulse); tl.EndLine();
} } } Here I created a bolean called "isStill". And in the void Update() I made isStill = true if the velocity of the rigid body is = new Vector2(0, 0) And if its not (else), then isStill = false. And then for each if statement we made I added (&& isStill ==true) to make sure the object is still to be able to perform this action
Bro hell yeah this was useful. This is like the first thing I've ever done that works. Definitely subbing and watching your other videos. Can we have the source code? Thx!
@@MuddyWolf To give u an idea of what i was doing, i created a "Prediction line" which basically draws an arrow in the opposite direction using the Line renderer. But when I shoot the ball, the ball's final trajectory isnt the same.
@@MuddyWolf In the end i resorted to the spring joint in unity. I used the spring joint for the pullback and just disabled it once it reaches the pivot point which works similarly to your video. Thanks a bunch anyway!
I didn't work for me, when i drag nothing happens Edit: Figured it out, for those of you who also have the same problem, change the second if statement to something like the one below if (Input.GetMouseButtonUp(0)) { endPosition = cam.ScreenToWorldPoint(Input.mousePosition); endPosition.z = 15; //sometimes the object will move even when you click so i made a new if statement //so object won't move unless you've dragged the mouse a more than 2 units if ((startPosition - endPosition).magnitude > 2f || (startPosition - endPosition).magnitude < -2f) { mforce = new Vector2(Mathf.Clamp(startPosition.x - endPosition.x, minPower.x, maxPower.x), Mathf.Clamp(startPosition.y - endPosition.y, minPower.y, maxPower.y)); rb.AddForce(mforce * power, ForceMode2D.Impulse); }
It's awesome ..but I really need help cause something came up and I'm really frustrated...I have made all the colliders as mentioned in the video but still, my player(ball) falls out of the area...Meaning no collision...Please if anyone has the solution for this please do help.....
Oh lol;-; I'm trying to make a line for a ball game just like this tutorial, maybe I'll have to watch multiple of them to get different ways of doing it
Force = Vector2(Mathf.Clamp(startPoint.x - endPoint.x, minPower.x, maxPower.x), Mathf.Clamp(startPoint.y - endPoint.y, minPower.y, maxPower.y));, this is and error it says u cant use VEctor 2 like a method.
yeah, make a boolean thats called in air. If it is in the air change the boolean to true. Make an if statement "if (boolean) is true" and pause the movement when its true
Was this tutorial useful? Would you like more tutorials on the elements of games I make?
YES IT WAS SUPER USEFUL!!! Can you make a video where we can see where the ball is going to head if we pull like those dotted line in Angry Birds??
Hmmm, yes maybe I will do a trajectory line video !
@@MuddyWolf I am getting ready for Ludum Dare 46 this 17th of April.....hope you will be also joining (in case if you don't know what is ludum dare, it is one of the world's largest game jams search google for more info)
@@Luckysury333 I am this will be the first one I join. To be honest I'm not the best at game Dev! I'm trying to get better but practicing then showing off what I learn in a tutorials for others!
@@MuddyWolf Yes trajectory line video would be great.
Absolutely nailed it! Even after 4 years, this is such a gold tutorial. You earned yourself a like and a sub
Awesome, thank you!
You are a great teacher. You got everything; fun, educative and not boring...
Thanks!
It's a 3D project, but we can change the z value to y value. Thank you very much for making a very useful tutorial. I wish you happiness.
you are a lifesaver
mate
This is an underrated Channel for sure here you are gifted with a sub
Thank you! I've started to put in works for future videos. A devlog will be on the channel tomorrow! :D
Damn dude you make awesome tutorials! Idk why you dont have more subs
You are very underrated! This is very helpful. Thank you.
Thank you
I can't thank you enough, it works, figured the first time didn't work because I got some lines wrong
On dragging it actually control the ball throwing force like( if mouse dragging length is short the force applied on the ball is low competitive the longer drag).
Amazing.👌
I was using it for a touch-controlled game and change a few things in there.
but anyway the Explanations were really good(others won't say which code is doing what or what is this line of code
we are writing is for.
I mean we learn it as you do it cause u explain everything, and we are not just copying everything you type without being able
to configure it for our own game later or understand it.
tnx a Lot.😊
Awesome tutorial.
First thing i will try tomorrow morning after my round of golf.
thanks, man this video was awesome, slowly and good explained, you spoke clearly, and I could understand every word, unity tutorials should always be like this subbed :)
Woo!
OMG thank you so much, i've tried to do this for 3 days and finally it's working, thank you !
14:54 😂😂😂 And great video by the way, really helped with my game.
Lovely Turtorial precise and easy to follow !!
Glad you liked it!
this channel is incredible
It's sad he didn't post for 4 months.. :/
It's coming back! I'm coming back! Woop!
More to come soon!
@@MuddyWolf Nice
Also, anytime I drag and shoot and collide with 2 or 3 box collider platforms, the drag and shoot doesnt work. Any fix?
Didn't use the whole tutorial, but was definitely very useful with working out how the line renderer works! Looking forward to watching more of your videos :)
Awesome!
@muddywolfgames awesome tutorial. have just one doubt ,,,, how do i show the power when the player interacts with game. i mean at the start of the video 0:10 i can see there is a power at the top centre, how can i achieve this?
Your video helped me to start developing a game that will be amazing. When I finish and upload it on steam you will get it for free.
Have fun! I'm excited to see what you create! :D
İ have a problem;
my line start from mid of the screen and lenght of line is very short. How can i locate close to the player and make it size longer?
I've got error at 21:26 : There is no argument given that corresponds to the required formal parameter 'position' of 'LineRenderer.SetPosition(int, Vector3)'
nevermind, I've writed lr.SetPosition(points); instead of lr.SetPositions(points);
Great tutorial! Explained really well and easy to understand
Thanks! 🙌
Hello! Thank you very much for the tutorial! I'm having issues when I set the camera to perspective mode. It only works correctly if it's in orthographic mode. Has anyone else experienced this? How can I solve it?
so i was wondering, how do you make it so you can only use it a certain amount of times when you are in the air and when you touch the ground it resets?
hello,how can i make the line follow the camera?
so,i am making the game where the camera follow the gameobject..when ever i try and draw the line ,the startpoint moves off the camera and i dont want this to happen...i want to follow the camera like ur game which shows at beggining ..please help
Wow, thanks. That is one of the best tutorials i have ever seen:)
Wow, thanks!
hello, could you make an example of a game similar to ddtank, where you have the aim and strength to shoot?
This was definitely useful. Thanks a lot for creating this tutorial.
If you want to make it so you can only drag when the object is still, Then the DragNShoot script will be this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public float power = 10f;
public Rigidbody2D rb;
public Vector2 minPower;
public Vector2 maxPower;
TragectoryLine tl;
Camera cam;
Vector2 force;
Vector3 startPoint;
Vector3 endPoint;
bool isStill = true;
private void Start()
{
cam = Camera.main;
tl = GetComponent();
}
private void Update()
{
if (rb.velocity == new Vector2(0, 0))
{
isStill = true;
}
else
{
isStill = false;
}
if (Input.GetMouseButtonDown(0) && isStill == true)
{
startPoint = cam.ScreenToWorldPoint(Input.mousePosition);
startPoint.z = 15;
}
if (Input.GetMouseButton(0) && isStill == true)
{
Vector3 currentPoint = cam.ScreenToWorldPoint(Input.mousePosition);
currentPoint.z = 15;
tl.RenderLine(startPoint, currentPoint);
}
if (Input.GetMouseButtonUp(0) && isStill == true)
{
endPoint = cam.ScreenToWorldPoint(Input.mousePosition);
endPoint.z = 15;
force = new Vector2(Mathf.Clamp(startPoint.x - endPoint.x, minPower.x, maxPower.x), Mathf.Clamp(startPoint.y - endPoint.y, minPower.y, maxPower.y));
rb.AddForce(force * power, ForceMode2D.Impulse);
tl.EndLine();
}
}
}
Here I created a bolean called "isStill".
And in the void Update() I made isStill = true if the velocity of the rigid body is = new Vector2(0, 0)
And if its not (else), then isStill = false.
And then for each if statement we made I added (&& isStill ==true) to make sure the object is still to be able to perform this action
hi, how can i do this in 3D? what would be the code? sorry to bother you my friend.
holy shit dued, thank you
idk if you are gonna respond to this because it's been 2 years sience you made this video
but the tutorial is great i just have an issue with it: the players can spam it and they can fly so how do i make like a cooldown system or that if the player stops moving then they can move again or something?
So what I did was create a boolean variable to track whether the player has used their drag and shoot ability or not. I wanted the player to have one chance to use the drag and shoot function and thats it. And when the player respawns it re-enables it.
bool hasShot = false;
if (Input.GetMouseButton(0) && !hasShot)
if (Input.GetMouseButtonUp(0) && !hasShot)
{
hasShot = true;
}
Then, in my respawn Coroutine I just added
hasShot = false;
so for you, I would recommend doing like a Coroutine WaitForSeconds and then setting the boolean variable back to false or something of that nature.
My left ear really enjoyed that one
Your left ear? 🤣
Thank You! That's exactly what I need
Greets Dominik
🙌🙌
thank you so much Muddy Wolf games. This was really helpful for me!
Great Tutorial! But unfortunetly it didn't work for me but you know it's okay, It was good explaining and atleast i learned alot with input, Thank you!
Followed the video and on finish the line renderer seems like it's attached to the ball object, so when i drag it spawns the line next to the ball rather than where I click. Did I miscode it or miss box tick in a menu or something?
Either way awesome video :) thanks for putting it out
Exactly what i was looking for, thank you so much :)
How to make it limited like 3 shots then its gameover
lovely video mate
I just don't understand what's the first parameter in the Mathf.Clamp( ) function and I don't get the use of it. Otherwise, everything else is clear.
Thank You!
Thank You for this tutorial. It was very useful and well produced too :)
You're very welcome!
Dummy question here: I have a ball with 9 child bones( to create the soft body effect). Initially, the script applied only to the rigid body "Ball" had no effect, so I've added the same script also to each bone and it works perfectly. With that said, is there another way of doing it? Not sure if that's the most lean way. Thanks
Use the scripts in the middle only bone
everyone i know im late to the party but i need help i followed everything but unity says "The type or namespace name 'TrajectoryLine' could not be found (are you missing a using directive or an assembly reference?)" pls help me ive been stuck for two days !
it's because of how the LineRenderer script is named, probably your script was not named "TrajectoryLine", try it out
When I try to add another line renderer for my player to make it so it has a trail while its moving and its not working. Does anyone know how to fix this?
i want to add cooldown for this shooting thing. please answer and tell us how we can add cooldown for this game please
Cheers
-your lovely followers :)
There's 2 ways you can do this! Either a by using coroutine function or by setting a boolean and setting it true after a timer, I would recommend looking into coroutines!
@@MuddyWolf i didnt understand that how can i do cooldown with using coroutine system. Can you show me one video that shows how can i add cooldown to my game using coroutine system please? I tried a lot of tutorials but they didnt work.
Great Vid! But is there a way you can drag and shoot once until you hit the ground so you won't keep shooting up in the air?
with a bool variable check if the ball is on the ground. or if collide with the boxcollider.
Hey man, I've really liked your tutorial and it helped me a lot; but can you help me with something? After I added animation to the script the ball only jumps straight in the air, it doesn't jump on the right or left part, do you know any solution for this? Thanks in advance!
Im getting null reference on line 39 and 49 in DragNShoot script
This tutorial is extremely helpful thanks a million!
Happy it helped!
Thank You For The Tutorial! I Am Working On A Stickman Game And With This I Can Make It Have Unique Movement
absolutely amazing exactly what i was looking for thank you
Hey excellent video but I have a question
How do you get the autocomplete and definition thing for unity because when I type it doesn't show all the options you have
Nice video! thanks, but how can i make the line attached to the ball?, if i disable use world space, still the line render where i got the mouse.
I have a problem with the code:(
Unity says no errors but when i just click without dragging it applys velocity on the y axis:( Can you/someone please help.
Hi, how can I make trajectory line that predict the path that the object will travel? Like angry bird. Also please make a tutorial on Archery game.
where did ub get the shapes from
How could i make dots, so before shooting , i know how object would fly
Im making bow shooting game.How i can rotate my bow in the right direction with this script?
Just wondering, how would I go about setting the start point to an object e.g. the ball instead of a camera point? So that my drag starts from the object, thanks so much! Great tutorial
You could use a raycast from mouse position and check for collision on an object by tag
Amazing tutorial , Thank you so much !!!
Glad you enjoyed it!
Ive 1 to 1 followed the tutorial. The ball doesnt shoot. Help
Awesome tutorial!
thank you so much for the tutorial, I'm trying to make the line renderer start from ball instead of my mouse point when i drag anywhere of the screen and the line will expand the opposite way, can you pls advice.
There is a setting on the line renderer component that says use world space, if you uncheck this the line will draw from the game object! I hope this helps!
@@MuddyWolf Yes it helps
I am thankfull to reddit for sending me to you
Woo, I'm happy you came! I hope you enjoy your stay! 😁
What if I want to check is gameObject still? (Cant shoot mid air)...
Then the DragNShoot script will be this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public float power = 10f;
public Rigidbody2D rb;
public Vector2 minPower;
public Vector2 maxPower;
TragectoryLine tl;
Camera cam;
Vector2 force;
Vector3 startPoint;
Vector3 endPoint;
bool isStill = true;
private void Start()
{
cam = Camera.main;
tl = GetComponent();
}
private void Update()
{
if (rb.velocity == new Vector2(0, 0))
{
isStill = true;
}
else
{
isStill = false;
}
if (Input.GetMouseButtonDown(0) && isStill == true)
{
startPoint = cam.ScreenToWorldPoint(Input.mousePosition);
startPoint.z = 15;
}
if (Input.GetMouseButton(0) && isStill == true)
{
Vector3 currentPoint = cam.ScreenToWorldPoint(Input.mousePosition);
currentPoint.z = 15;
tl.RenderLine(startPoint, currentPoint);
}
if (Input.GetMouseButtonUp(0) && isStill == true)
{
endPoint = cam.ScreenToWorldPoint(Input.mousePosition);
endPoint.z = 15;
force = new Vector2(Mathf.Clamp(startPoint.x - endPoint.x, minPower.x, maxPower.x), Mathf.Clamp(startPoint.y - endPoint.y, minPower.y, maxPower.y));
rb.AddForce(force * power, ForceMode2D.Impulse);
tl.EndLine();
}
}
}
Here I created a bolean called "isStill".
And in the void Update() I made isStill = true if the velocity of the rigid body is = new Vector2(0, 0)
And if its not (else), then isStill = false.
And then for each if statement we made I added (&& isStill ==true) to make sure the object is still to be able to perform this action
How can i instantiate an object in the trajectory lines direction? Can anyone help?
i keep getting error code cs1061 for the drag and shoot code and i dont know how to fix it
can anyone help
does it work for mobile?
exactly what i was looking for
Awesome!
nice tutorial, but how about on a 2d project with perspective camera?
Bro hell yeah this was useful. This is like the first thing I've ever done that works. Definitely subbing and watching your other videos.
Can we have the source code? Thx!
Awesome, thank you!
this didn't work for me and i have no idea what to do he tell me the cam doesn't exist
Yeah it works! However, it isnt accurate for me. Any idea why?
Hmmm, I'm not sure without seeing it
@@MuddyWolf To give u an idea of what i was doing, i created a "Prediction line" which basically draws an arrow in the opposite direction using the Line renderer. But when I shoot the ball, the ball's final trajectory isnt the same.
@@MuddyWolf In the end i resorted to the spring joint in unity. I used the spring joint for the pullback and just disabled it once it reaches the pivot point which works similarly to your video. Thanks a bunch anyway!
Nice Video man
Appreciate it
will this work for 3D the "Drag code"?
thank you
I haven't tested it to be honest!
First, thank you for this awesome Tutorial!!^^
Why do you use Vector3 for startPoint and endPoint? What can be a problem with Vector2?
Because he wanted the line to be shown if it was Vector2 you cannot change the startPoint.z which he did in the video 11:00
is there a way you can tell me how to change it instead of mousebutton to touch, for mobile uses, thank you :)
Hi! I'll make a drag and shoot with mobile touch controls sometime today.
@@MuddyWolf great! thank you so much
Recorded, edited, uploading be out by 2/2:30 BST today
@@MuddyWolf great! cant wait
Great video - thanks!
When i drag nothing comes up what should i do??
I didn't work for me, when i drag nothing happens
Edit: Figured it out, for those of you who also have the same problem, change the second if statement to something like the one below
if (Input.GetMouseButtonUp(0))
{
endPosition = cam.ScreenToWorldPoint(Input.mousePosition);
endPosition.z = 15;
//sometimes the object will move even when you click so i made a new if statement
//so object won't move unless you've dragged the mouse a more than 2 units
if ((startPosition - endPosition).magnitude > 2f || (startPosition - endPosition).magnitude < -2f)
{
mforce = new Vector2(Mathf.Clamp(startPosition.x - endPosition.x, minPower.x, maxPower.x), Mathf.Clamp(startPosition.y - endPosition.y, minPower.y, maxPower.y));
rb.AddForce(mforce * power, ForceMode2D.Impulse);
}
}
What is the difference?? I have the same Problem, i exactly made it like him but it is not working for me...
Muchos thank's amigo, llevaba un buen rato dándole vueltas y no savia que hacer, hasta que puse tu código.
can i get your desktop wallpaper please?
I don't have it anymore and don't remember where I got it from... Sorry!
Why my player jump in only y axis
Really helpful! thanks for the tutorial!
14:54 "OHHH it's gone it's gone far and wide" 😃
It's awesome ..but I really need help cause something came up and I'm really frustrated...I have made all the colliders as mentioned in the video but still, my player(ball) falls out of the area...Meaning no collision...Please if anyone has the solution for this please do help.....
check the Z transform
The script worked but the effect would only show a dot
with TrajectoryLine is gave an error saying It could not be found, what happened?
Same problem, did you find a solution?
Vatsal Bhalani no :( I decided to not use the line at all, It was for testing anyway
Oh lol;-; I'm trying to make a line for a ball game just like this tutorial, maybe I'll have to watch multiple of them to get different ways of doing it
@@vatsalbhalani4554 did you solve the problem ?
Hey! Could this be used in 3d
Hey bruh how to do you learn unity
can you share somethings to us......................
I just read the documentation! It's really useful!
heemmmmm why the ball do not move in my variant
My trajectory line doesnt work can someone help please?
Gotta expound a bit my dude.
Dude you've helped me so much for this upcoming game jam! Thank you so much! Sub +1
Force = Vector2(Mathf.Clamp(startPoint.x - endPoint.x, minPower.x, maxPower.x), Mathf.Clamp(startPoint.y - endPoint.y, minPower.y, maxPower.y));, this is and error it says u cant use VEctor 2 like a method.
use "new Vector2(...code here)"
it not showing ridgidbody in code
Thank you!
You're welcome!
Sit back grab your snacks - love it. LOL
😂
Thank You so much
very helpful
oh thats pretty epic
Woop!
how can i prevent multiple jumps?
yeah, make a boolean thats called in air. If it is in the air change the boolean to true. Make an if statement "if (boolean) is true" and pause the movement when its true
@@clumsycaden5708 thx. i fixed already. 👍😀
@@bitmodelstudio oh ok, I thought so since you commented 2 weeks ago