![]() ![]() Then all we have to do is to convert to degrees and decide how much of an angle it should be to trigger. If LeftOrRight > 0 – then we are in the right side Local LeftOrRight = mouseVec.Unit:Dot(Vector2.new(1, 0)) Then if we do the same but with the right vector we can then figure out if we are in the top left, top right or bottom left or bottom right. If TopOrBottom > 0 – then we are in the top half of the wheel Local UpOrDown = mouseVec.Unit:Dot(Vector2.new(0, 1)) Then you will want to dot product the mouseVec with a up vector. local mouseVec = (Vector3.new(mouse.X, mouse.Y) - centre) Your first vector should be the vector from the centre to the mouse’s positionĮ.g. Next is detecting when we are in the segments.įor this we will need to calculate the angle of the mouse from the top (think of it like bearings).įor this we can use dot product to figure out which quadrant we are in. Then if you check if the distance is less than the radius of the circle, it means we can have then detected when it is in the circle. ![]() local centre = Instance.new(“ScreenGui”).AbsoluteSize/2 (might have to be parented to playerGui) ![]() You can get centre of screen by taking the absoluteSize of a screenGui and halving itĮ.g. You can get the distance using (pos1 - pos2).magnitude Get the distance of the mouse to the centre of the screen. If you want it accurate then we can do a more mathsy approach. Mouse enter won’t be great for this as gui objects are counted as squares. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |