- Home /
iOS Rididbody Collisions
I'm having issues with my rigidbodies falling through each other slightly.
Im creating a boggle clone, with a 5x6 grid of letters. Each letter has a rigid body that is non kinematic, interpolation is Interpolate, and Collision Detection is Continuous Dynmaic. When the user forms a word, the letters are deleted and new ones fall from above. I'm using triggers to determine the row / col position of the letters, this is why I'd like to use rigidbodies.
I'm using rigidbody.MovePosition() to handle movement. Everything worked fine until I tried moving this to the iPhone. On the computer, a Fixed Timestamp of 0.001 works fine, but it crawls on the phone. Updating the Fixed Timestamp between 0.04 - 0.067 greatly increases the speed, but the collisions are no longer accurate. I've sorted through tons of similar questions, but was unable to find a working solution.
Any advice on increasing collision accuracy and mainting a good fps would be greatly appreciated.
Thanks, Jon
You could also try reducing the $$anonymous$$imum penetration penalty if you objects arent actually passing through the "ground" see here.
I'm not sure you really need physics for Boggle do you? Do you just want the rigid bodies for collision and handle the movement yourself? Set is$$anonymous$$inematic = true.
I've tried both solutions without any luck. I need my box colliders to be small, so maybe I need to do a check like a 2d collision system works with checking if a point is within a rectangle(3d cube)
I've updated my FixedUpdate method. The behavior is better, but I'm looking for the letters to stop falling at a consistent distance between letters.
void FixedUpdate() {
var moved = FallSpeed * Time.deltaTime;
var offsetVector = new Vector3(0, myTransform.collider.bounds.size.y / 2, 0);
var offsetPosition = myTransform.position - offsetVector;
if (Physics.Raycast(offsetPosition, Vector3.down, out hit, moved))
{
if (hit.transform.tag == "Coin"
|| hit.transform.tag == "Lift")
{
if (coinComponent.IsFalling)
coinComponent.IsFalling = false;
}
}
else
{
// Hit nothing, falling
coinComponent.IsFalling = true;
coinComponent.Triggered = false;
myTransform.Translate(Vector3.down * FallSpeed * Time.deltaTime);
}
}
Your answer