Hey guys! I’m not an expert at coding and i need help with my script. Please help me!
So i have a golem enemy. This golem can throw Rocks
at the player. But i want the rocks to have gravity, but the code has to calculate how far is the player because the rock wont hit him is it uses the same amount of Force everytime. Thank you
Hello @ZalanGames1, could you share your code with us? Without the code, I can only offer a few suggestions.
To determine the distance between two objects (in this case between the Golem and the player), use Vector3.Distance
(Documentation: Unity - Scripting API: Vector3.Distance ).
Store the distance in a variable, then you could divide the distance, by the amount of time you want your object to travel the distance to figure out how much force you need to apply.
This may or may not work, because I have not yet tested this out for myself (I am still a beginner), but in theory this should work.