Hello, I have multiple 2d boxes with rigidbodies, each is connected to all of it’s immediate neighbours using a fixedJoint2d. I’m applying a force to some of the boxes in order to move the entire structure around.
It works for the most part, but for some reason when I spin it around it randomly gets stuck and then sometimes wont start up again.
moving it in a straight line works flawlessly.
Is there a setting I should be applying to my rigidbodies or joints to prevent this from happening?
I made a short video to demonstrate - notice it forcefully stops spinning even though I’m applying the exact same force:
https://puu.sh/EF66h/1d69d1ad02.mp4
I’m using default settings for the rigidbody and the joints.
The arrows on the squares point to their “Up” direction, and the particles show that force is being applied.
Here’s the code to apply the force, I appreciate any help, cheers.
protected override void KeyDown()
{
StartThrust();
}
protected override void KeyUp()
{
StopThrust();
}
private void StartThrust()
{
thrusting = StartCoroutine(Thrusting());
particles.Play();
}
private void StopThrust()
{
StopCoroutine(thrusting);
particles.Stop();
}
private IEnumerator Thrusting()
{
while (true)
{
rig.AddForce(transform.up * power, ForceMode2D.Force);
yield return new WaitForFixedUpdate();
}
}