- Home /
Physics Material slow down the game.
Hello everyone, I have developed game something like coin dozer. And for the smooth movement of coin i have add one Physics Material to each coin but my game is very slow after doing that . Is there any alternative of that or how can i make coin movement smooth without use of Physics material . So can anybody help me to come out from this situation.
Answer by Owen-Reynolds · Jun 05, 2013 at 03:10 PM
There seems to be confusion between a physics material and a collider.
The physics material affects how bouncy and slippery the coins are. If you don't have one, Unity still has to make up values, so adding physics materials shoudn't give any slowdown at all (well, unless all that bouncing slows the game down.)
The collider is the shape they "count as." In this case, best to probably build a low-poly cylinder to use as a mesh collider. For example, your coins might have 64 sides, to look round. The same size 16-sided mesh might be a good-enough collider.
If the coins were all on the floor and never stacked, you could use a capsule or sphere, locked to only spin one way, with the "real" floor below the one you see (otherwise the coins would float.) But your coins can stack. A sphere collider forces them to stack like marbles. You could make the sphere smaller, but then the edges of your coins would overlap. Capsules are stretched-middle spheres. They can't be shrunk into a coin shape.
A very short box collider will make the edges of the coins catch more, slide against each other funny, and either overlap or have an extra gap (if the box is scaled to so the coins holds the box, or the box holds the coin.) The coins will act like tiles. You could rotate 3 or more boxes into a ninja star, but then the spiky ends would catch funny on other coins.
It would probably also work to arrange maybe 8 thin rectangular boxes into the sides of an octagon. Adjust one so it sticks straight out with the far side where you want it, then copy the parent, rotate 45 degrees, adjust so the corners meet, then copy/spin that 3 more times.
Thanks for reply. I found that the problem is in my $$anonymous$$esh Collider. if i use Box collider then my game works very smoothly. now the last paragraph of you answer will help me. but how can i use multiple box collider into coin mesh? i am new to unity so i am asking this question.
Can look up "compound colliders" for the official page. $$anonymous$$ake several child colliders. This allows you to move and rotate them any way you want. All children colliders are "added up" and count as you having the whole combination.
A trick is to make a cube (which gives a Box collider and the mesh) so you can see what you are doing. Then "click off" the mesh when done.
Answer by Hotshot10101 · Jun 05, 2013 at 04:27 AM
I would recommend using the Vector3.MoveTowards method. If you look in the help it should be pretty straight forward how to use it to change the transform.position. If not post here again and we can help further.
It's not possible. In the game there are approx. 50 coins on the floor and pusher is push to the coin so the coin will move forward that is the game.
$$anonymous$$aybe if you describe the game a little more? If you don't want to describe in public on the forum you can private message me and I will try to help. If you are ok posting more about the game here please do an we can help more.
Here is the video of game : http://www.youtube.com/watch?v=tnWlX24Z00E
Ah, now I see. Originally I thought you were just talking about moving coins towards some point in a smooth way. You really do need to physics.
What kind of physics material do you have now? Is it a mesh collider? If it is then you could try a sphere or capsule collider ins$$anonymous$$d. I think that will be faster. If you are already using a sphere or capsule collider then I am not sure what might help.
Someone else might have a better idea. The physics components are not my strength.