#how to check if the arrow is on top of the red gui part?

1 messages · Page 1 of 1 (latest)

west cloud
inner oracle
#

so like if the red part is centered at the top, that would be 0 degrees, so you check whether the arrow is rotated -90 to 90 degrees

#

if that makes sense

west cloud
#

so you want me to figure out which angle range the red part takes up

inner oracle
#

yes, then when the player presses space, check if the arrow is within that range

#

this required the arrow and red area to be synced, to where the same angle points in the same direction

#

or just calculate the offset and add that in

west cloud
#

I can get the center point I am already am using it in my code but how do I use it to get the angle range you're talking about

inner oracle
#

are you rotating the arrow from the center point?

#

if so you can just use the rotation property

west cloud
#

I am changing the rotation and position of the arrow

inner oracle
#

hmm, if possible I would change it, to where the arrow is at the top of the image and the center is blank, so you can line up the arrow to the circle, and just rotate that

#

instead of worrying about position

#

im bad at explaining things ill see if I can find a reference

west cloud
#

If I just change the rotation of the arrow then it will just spin around itself

inner oracle
#

instead of this

#

do this

#

red dot is center for both

#

the second method allows you to rotate the arrow while updating its position aswell so it stays in a circle

#

you just have to center the image to the center of the circle, and resize it to the arrow is in the right spot

inner oracle
#

angle 180 would be directly opposite, etc

west cloud
#

I am having trouble understanding what you mean, you want the arrow and the circle to have the same center?

inner oracle
#

yes

west cloud
#

but that would look dookey as hell

inner oracle
#

how come? it should look the exact same, but instead of updating the position and rotation of the arrow you are just doing the rotation

#

but lowkey I just realized you might not need to, cause you are still rotating the arrow image, so just use that

west cloud
inner oracle
#

then you can compare that to the range of the red target area

west cloud
#

so we're basically converting rotation into position

inner oracle
#

kinda

west cloud
#

so I gotta figure out how much the position changes relative to rotation

inner oracle
#

assuming you are setting the rotation of the circle to get its different target area positions

west cloud
inner oracle
#

yes

west cloud
#

well idrk if it's exactly quarter

inner oracle
#

thats just what it looked like, you will have to figure that out tho lol

west cloud
#

I can send you a pic that might help with that

inner oracle
#

that looks like a quarter lowkey, might be ever so slightly less

#

but make sure both the circle and arrow is rotated to be synced, will prob make your life easier

west cloud
inner oracle
#

I would do
arrow.Rotation - circle.Rotation + 45 <= 90
im pretty sure you can go negative with this, life if arrow is at 90 and circle is at 130

#

we are looking for -45 to +45, so we can add 45 to the value to get it within the range of 0 - 90

#

just do an extra check to see if its below 0

west cloud
#

ok so after a basic experiment using print(arrow.Rotation, circle.Rotation) I found that the arrow and the red part are somewhere in the 0 to -90 range

inner oracle
#

oh, then i guess just check for that then

west cloud
#

so basically arrow.Rotation - circle.Rotation >= -90

inner oracle
#

as long as the number cant go above 0 then yes

west cloud
#

so okay I am getting inconsistent behavior sometimes it counts it on the red part and sometimes it doesn't lemme do print again

#

lemme use modulus ig

#

because roblox does angles in the 180 to -180 range

inner oracle
#

oof

west cloud
#

I am gonna record a video rq

#

because this behavior is pretty inconsistent

inner oracle
#

k

west cloud
inner oracle
west cloud
#

also here's the final product js incase it wasn't clear:

(arrow.Rotation - circle.Rotation) % -180
inner oracle
west cloud
#

the arrow's rotation begins at 0 and the circle also begins at 0 if that's what ur asking

inner oracle
#

when they are both 0 does the arrow perfectly overlap the target in the middle

#

or when they share the same rotation value in general

inner oracle
#

that could be it, at least its def a problem, because if both rotations are the exact same, then it would visually look incorrect, when our math states otherwise

#

either try to find the difference in rotations and include in the calculation or manually rotate the circle png to be at the top

#

like the png itself

west cloud
#

I could make the arrow hit the middle of the red part the recalculate the range using print

inner oracle
#

oh that works

#

yeah

west cloud
#

rotation is 69 lol:

inner oracle
#

so add 69 to the circle rotation maybe

west cloud
#

lemme do print again

inner oracle
#

rip

west cloud
#

I think the modulus I added messed it up, it's probably that I got the range wrong I have to be like on point

inner oracle
#

interesting, thats probably a sign of progress tho

west cloud
#

ok yeah works for the most part any issues are probably due to the range being slightly off, anyway thanks for the help @inner oracle