#aiming deadzone, converting positions to vectors.

8 messages · Page 1 of 1 (latest)

jagged orbit
#

Trying to make a spacecraft flying system and I'm going to base some of the movement off of a UI element. I've got it very close but something is wrong I can't nail it down. Video shows what I got, its pretty close and hope it does it good job of showing what I'm after. Dumping the roblox game file and code here.

vestal bladeBOT
#

studio** You are now Level 1! **studio

jagged orbit
#

The jist of the code is I have one small circle that is moved by the mouse's delta. I convert its position into a vector(from screen center). If its still within the range of the large circle it replicates its position to a second small circle. if its not then I create a percentage based on its distance from the edge of the screen and create a new vector that's length is (that percentage) * (radius of the large circle). That new vector is converted into a udim2 position and applied to the second small circle.

#

I multiply that percentage by an aribitrary number (8 atm) to aritifically constrain the movement to a portion of the screen so the player does't actually have to move the circle to the edge to get the second circle to its maximum range.

jagged orbit
#

even though this discord sucks ill still put the updated code, got it working myself.

vestal bladeBOT
#

studio** You are now Level 2! **studio