I would like to make some sort of this simulation below, where user can interact with the white rod and drag it into the magnetic fields, which in resulting the blue line that represent the magnetic field of the permanent magnet to move in semi-circular motion. enter image description here

I managed to get that kind of effect using animation enter image description here

I wish I do not have to make an animation for it by manipulation path for the sphere to be automatically correcting it's own path after colliding with the round object since the sphere will suddenly moving faster than usual when colliding with much bigger round object.

I have tried using splines etc, but most tutorial I've seen are not editable in play mode, which is I cannot alter any of the curve values inside my script. So can anyone could provide me some insight or another better alternative than this? I've been stuck here for three days now.


EDIT: enter image description here

  • \$\begingroup\$ "I have tried using splines etc, but most tutorial I've seen are not editable in play mode, which is I cannot alter any of the curve values inside my script." Splines was going to be my answer, but no matter the tutorial you should be able to alter the variables of a curve to fit your needs in play mode. Could you provide more details of why you can't do that with the tutorial that you followed? \$\endgroup\$ – TomTsagk Oct 10 '18 at 13:15
  • \$\begingroup\$ I already managed to alter the position for each points in playmode, but is it possible for points in the splines to have a rigidbody properties? and making it elastic so the path will make the sphere moves like above gif when the points is colliding with the cylinder, and transform back to the original curve. I did try to make a physics collision for both cylinder and the sphere but the sphere is ignoring the collision no matter what is in front of it's path. Sorry for any confusion. \$\endgroup\$ – Mira Oct 10 '18 at 15:34
  • \$\begingroup\$ The reason you would use a spline is to have control over the curve you want to create. Based on your first image, you could change the values of the curve to have a ball follow the desired path. You could make the sphere itself be a RigidBody but that would have weird results if you are setting its position instead of applying forces. To be honest, I'm not very sure I understand the connection with the two pictures. Should the sphere loop indefinitely around the cylinder if it comes to close? \$\endgroup\$ – TomTsagk Oct 10 '18 at 15:52
  • \$\begingroup\$ The first picture is the original idea that I wanted to create, where I can bend the blue lines when its colliding with the cylinder, the blue arrows supposed to actively moving across poles, so I tried to replicate it on the second picture, since I cannot figure out how to actually create a bendable mesh like the first picture, so I am planning to create the arrow movement first. I added new picture to illustrate my problem, no matter how many rigidbodies blocking the sphere, it will pushing them instead. \$\endgroup\$ – Mira Oct 11 '18 at 1:40

So I decided to use Line Renderer instead and implemented Bezier spline on it, and I managed to get the same result as the first picture where I can control each points that will effect the Line Renderer curves as well. Here is the link of the tutorial. enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.