#It would end up being sqrt 2 2 when you
1 messages · Page 1 of 1 (latest)
sorry i had to go somewhere can i make this a thread?
the vector is already normalized in another script so i dont think that would help
The original message seems to be gone, so maybe add context if you expect an answer.
Does using diagonal vectors work though?
sorry im kind of a beginner, what are diagonal vectors, is it just Vector2.(1, 1)
I would personally use Vector2(1,1).normalized for up-right diagonal
But technically it would be Vector2(1,1)* Mathf.Sqrt(2)/2
Or Vector2(Mathf.Sqrt(2)/2, Mathf.Sqrt(2)/2)
Basically, if you want diagonals, you cant use Vector2.up, .right, etc
ok, the thing is I'm already normalizing the vectors and the problem is that the arrows aren't being spawned at the right place but the velocity they are launched at is correct
i could show you a video of how the cardinal directions work and how the diagonal directions (don't) work and tell you what i want to happen
as you can see it works properly for the cardinal directions but spawns them all in the same place for the diagonal directions i want it to be just like the cardinal directions just rotated, how could i do that with code?
Hmm
So your trouble isnt with the angle themselves, but the random spread?
How do you determine the position and rotation you spawn the arrows in?
yes i have a function called FindOffsetAxis(float offset, Vector2 facingDirection) if the player is facing in a cardinal direction then it returns a Vector2 with the y and x axis flipped( the y value becomes the x value and vice versa) and multiplies them both by the offset which is the degree of randomness
ill send you a paste myst of the code