# One actor moves toward another based on proximity?

Member, PRO Posts: 94

All,

I am trying to develop a learning game based on physics (electric principles, etc) and im trying to figure out how to make certain tasks interactive. I am having trouble putting into words what i am trying to do which is making a forum search difficult so forgive me.

I would like to make a hanging ball that as a negatively charged rod is put closer to it the ball starts to move toward the rod, thus showing it has a positive charge. I understand tying one set of coordinates to the other but if i want one end to remain attached? and how do i do this based on the proximity of the rod?

Kind of like this. Any thoughts or where to start looking.

• Member, PRO Posts: 582

use the magnitude function to determine the distance between the two, within a rule that says if that distance <= x, then do whatever you need it to do.

• ImagineLabs.rocks Member, BASIC Posts: 5,717

Here is a video I did about the Magnitude Function if you want to check it out.

• Member, PRO Posts: 94

@jamie_c PERFECT!!!

• Member, PRO Posts: 94

Wanted to thank everyone for their input and show what has been done so far. Its very flawed but I couldnt have gotten tis far without your help. Its not complete but gives you the iea of where its going.

• ImagineLabs.rocks Member, BASIC Posts: 5,717

@Jeffm2, That's really cool. Seems like it's coming along nice. I completed the first task and it didn't move on to a second, I assume it's not programmed in yet but just in case I wanted to let you know.

• Member, PRO Posts: 94

@jamie_c Right. Just the one so far

• Member, PRO Posts: 582

that's pretty cool.

seems to be a layering issue with the notebook and plastic rod though that takes away from the depth effect on the display.