MaxForce property for LineForce when InverseSquareLaw is enabled

I’m simulating an electromagnet by using two line forces to pull the two objects together, each with flipped attachments of the other. One is the magnet force, the other is the reaction force. I want to use the InverseSquareLaw property because it’s appropriate for the application, but I’m having trouble.

Imgur

The issue is that whenever the parts get too close, the force exponentially increases, as it should, but the force becomes so much that it’s bugging out my system. If I just lower the magnitude of the lineforce, I won’t get the power I want to get.

My suggestion is to add a MaxForce property to lineforces that caps effective force. Otherwise, I think I’ll have to check the distance, and if it’s too close, switch to constant force. I don’t really want to do that many magnitude checks.

7 Likes

I don’t think magnitude checks are particularly expensive, but I think scripts not running at the same rate as physics is a potential issue.
Another temporary fix could be to use the Touched event and weld the object to the magnet.

1 Like

Good idea! I should be able to add a maxForce property to this constraint.

BTW This force increases “Polynomialy” not “Exponentially”.

2 Likes

Great, thanks! Also, what about ReactionForceEnabled for this so you don’t have to do two LineForces to get a reaction?

Today we released:

  • MaxForce (when InverseSquareLaw is enabled)
  • and ReactionForceEnabled

both properties for LineForce.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.