for a simple fix, easier for my brain to process as its what i am used to for games i have played in the past instead of this rb.AddForce(direction * strength * shotPower); i did this rb.AddForce(-direction * strength * shotPower); just so you pull back on the mouse to increase power. ofc it is all preference, but this is what I prefer
This could be done by splitting the worldPoint into a normalized vector3 and it's strength (vector3.magnitude). Then clamping the strength between 0 and some max value. Then we could reconstruct the vector3 based on that.
@@GreekGamerJim I didn't see the video but the logis is that the vector3.normalized is the vector with the minimium to get the direction, and the vector3.magnitude is how many minimiun (nomalized) fits in. then you limiting the magnitude of vector (ex if the magnitude is 10, and you want the max to 5, you createnew verctor with minimium times 5, (normalized times 5 in this case)). now you clamp the values based on that (limit these values between 2 numbers), starting from 0 to max value (max force applied to ball) you can use chatgpt to help you on that...
Can anyone tell me the physics materials values i should attached to my ground and ball cuz my ball bounces and then goes in a straight line.... Plz help
my linerenderer in not displaying correctly like instead it displaying from the centre of the ball it appears on a random part of my screen, How do I fix this?
Thank you very much for the content! A question, I would like to change the direction that drags the mouse, instead of dragging forward, dragging backward, do you have any idea how to solve it?
Around 10:15 I add a ShotPower variable to the script. If you assign a negative value to that variable in the inspector the force that gets applied to the ball will be in the opposite direction of the dragged force.
@@AIAdev Thanks for the reply man! I actually meant it like this: Currently in the script the player needs to drag the mouse forward and the line renderer will go in the same direction as the mouse, but how do I drag the mouse backward and keep making the line renderer show the same forward direction in the video, so the line renderer will go in the opposite direction of the mouse and the object will be thrown in the direction of the line renderer. Sorry for my English
@@kioka2 You could try doing some vector math to rotate the 2nd point drawn by the renderer by 180°. This seems like a case where Dot.Product would also work but I admittedly don't fully understand how to use that to be able to help.
You are checking for inputs in the FixedUpdate function. FixedUpdate, instead of running once every frame, only runs once every physics tick, depending on the physics in your scene there may be more than one tick per frame or one tick every 10 frames.
thanks man helped me alot also my linerenderer in not displaying correctly like instead it displaying from the centre of the ball it appears on a random part of my screen, How do I fix this?@@GreekGamerJim
for a simple fix, easier for my brain to process as its what i am used to for games i have played in the past
instead of this
rb.AddForce(direction * strength * shotPower);
i did this
rb.AddForce(-direction * strength * shotPower);
just so you pull back on the mouse to increase power. ofc it is all preference, but this is what I prefer
Was considering making a mini golf game over the summer and this is the perfect start.
Nice video,really curious to know how you're gonna limit the player drag distance.
This could be done by splitting the worldPoint into a normalized vector3 and it's strength (vector3.magnitude). Then clamping the strength between 0 and some max value. Then we could reconstruct the vector3 based on that.
@@AIAdev I know this is an old video but could you provide an example of this? I've been trying to figure it out for hours now.
@@GreekGamerJim I didn't see the video but the logis is that the vector3.normalized is the vector with the minimium to get the direction, and the vector3.magnitude is how many minimiun (nomalized) fits in.
then you limiting the magnitude of vector (ex if the magnitude is 10, and you want the max to 5, you createnew verctor with minimium times 5, (normalized times 5 in this case)).
now you clamp the values based on that (limit these values between 2 numbers), starting from 0 to max value (max force applied to ball)
you can use chatgpt to help you on that...
Please make more parts to this
I’m currently working on a next part :)
Can anyone tell me the physics materials values i should attached to my ground and ball cuz my ball bounces and then goes in a straight line.... Plz help
my linerenderer in not displaying correctly like instead it displaying from the centre of the ball it appears on a random part of my screen, How do I fix this?
do you have any solution?
@@GhazyAzhar I set the line renderer to "Use World Space" and it fixed this issue for me.
@@SerinitySW thank you
Thank you very much for the content! A question, I would like to change the direction that drags the mouse, instead of dragging forward, dragging backward, do you have any idea how to solve it?
Around 10:15 I add a ShotPower variable to the script. If you assign a negative value to that variable in the inspector the force that gets applied to the ball will be in the opposite direction of the dragged force.
@@AIAdev Thanks for the reply man! I actually meant it like this:
Currently in the script the player needs to drag the mouse forward and the line renderer will go in the same direction as the mouse, but how do I drag the mouse backward and keep making the line renderer show the same forward direction in the video, so the line renderer will go in the opposite direction of the mouse and the object will be thrown in the direction of the line renderer. Sorry for my English
@@kioka2 You could try doing some vector math to rotate the 2nd point drawn by the renderer by 180°. This seems like a case where Dot.Product would also work but I admittedly don't fully understand how to use that to be able to help.
@@AIAdev Thank you man!
haha was about to ask the same question
This its greath, thanks man!
You're welcome! Thanks for leaving a comment :)
For some reason it is random when i shoot the ball. Like the ball decides when it wants to shoot and when it doesn't. Do you know why this happens?
Without seeing your code and how your scene is set up, it’s hard to say. Feel free to join the discord in the description and I can help you out there
You are checking for inputs in the FixedUpdate function. FixedUpdate, instead of running once every frame, only runs once every physics tick, depending on the physics in your scene there may be more than one tick per frame or one tick every 10 frames.
thanks man helped me alot also my linerenderer in not displaying correctly like instead it displaying from the centre of the ball it appears on a random part of my screen, How do I fix this?@@GreekGamerJim
where did u get the box part and that from the start
I constructed it using Probuilder in Unity
Very good video. How to make this works in android phone by the touch of the user?
Its a bit late but the mouse input already works with touch ive tried it
Awesome
When are we getting part two? I am excited!
I'm glad to hear it! I'll put something together soon
I don't know if you've seen part 2 yet but it went live last week! ruclips.net/video/nPYoQ09q-xw/видео.html
Simple and explained well
Thank you!
Amazing video keep going :)
thanks :)
When's the next part?
Next week :)
@@AIAdev ok thanks