0
votes

This is the setup I have. I am trying to make a game in unity which appears 2d but is actually 3d. I have a simple sphere and a floor, which is made up of cubes placed next to each other(the colliders overlap a little) with the same Y value and Z value. My 2d plane is in X-Y plane(Z being the depth).

Now in the script attached to the sphere, in the Update function, I have used rigidbody.addForce() in the +ve X axis function to move the sphere forward. I have attached rigidbody to the sphere and enabled gravity. The collider of the sphere is the default one.

Now the problem is:

When I run this scene. The sphere moves forward but at the intersection of the colliders, it jumps a bit(very less but still noticable) upward and loses its momentum. It happens at every intersection.

BUT this does NOT happen if I place the sphere on a floor made up of a SINGLE cube(a very long one).

Is this problem arising because of overlapping colliders? How do I solve this issue?

Thanks in advance

1
What happens if you remove the overlap, and just make sure that the colliders are adjacent?Dan Puzey
How do you suggest I remove the overlap? It is very tough to manually do it. I have information about the cube's collider dimensions. How do I solve it using that?user854617
if i would you i would set friction to 0 and drag to 0 , even though it losing momentum via collision with overlapping cubes. the only sure solution would be to make sure they are not overlappinglemunk

1 Answers

0
votes

I don't think this is fixable. Unity physics is approximate, and even when physics material are set up to 1.0 bounciness, momentum doesn't stay constant — I learned it the hard way when I tried to develop a game depending on constant momentum, and had to write my own little physics simulation for that.