I’m currently working on a project with flying drones. And i’m encountring a problem with some physics tricks.
My drones use the rigidbody to move with “AddForce()”. I want a drone to become a magnet and attract everything around him. The problem is that i can’t work with Rigidbody.AddForce() on each object because they will collide with the drone et push him. I have tried to work with Joint and create a “link” between the drone and each object, but it’s really tricky and hard to balance. Couldn’t find at this moment the best way to achieve this…
Can anyone give me advice? Or have anyone found a solution?
You may link each object via ConfigurableJoint with all motion constraints in “Free” mode. Then use the X Drive, Y Drive and Z Drive properties for specifying the behavior of the “magnet”. Most likely you’ll set constant values for Position Spring and Position Damper (very large spring and very small damper).
Then you may dynamically calculate a value for the Maximum Force parameter of the drives on each object based on the distance to the magnet. Far objects would receive a small or zero max force, so they won’t likely move. Closer objects will receive more and more force (most possibly in a exponential curve with smaller distance, check formulas for magnetic fields) so they would be attracted towards the magnet in a realistic fashion.
This way the drones would also react realistically to the increased weight as for the “magnetic forces” attracting other objects. You may even define the global maximum force the magnet can apply to the objects, so you could switch it on/ turn it off, or progressively adjust the intensity.
I am working on Roulette game and I wanna achieve to stop ball on any number which I have decided.
For this, I put an object to every number and trying to activate magnet on specific object that will enforce the towards its direction.
But somehow when I activate magnet on an object it creates a magnetic field and ball moves surround this field and never reach to object.
I think your solution for the upper problem can help me. So if you provide me that solution work or give any suggestion that will be so much helpful for me.