- Home /
Why is my mesh acting like it has a bumpy surface?
I'm working on a golf prototype game in which the ball is pushed in the x,z axis (via AddForce, force mode is impulse). The only force acting in the y direction is gravity (set at 98.1 to make the ball fall realistically as upping the mass does nothing). I've imported a large single mesh from Blender into Unity and on the flat areas the ball is hitting non-existent bumps everywhere! The ball has 0.6 bounciness and maximum bounce combine (which is the 0.6 bounciness) on its physics material and is pushed ONLY in the x,z direction. Why is it hitting bumps along a flat mesh that has no edges/vertexes on it (it's just one large face). I would understand if the mesh had multiple vertexes/edges, made up of many faces, but it's just one large face inside 4 edges/vertexes.
Answer by AlwaysSunny · Jun 25, 2015 at 04:46 AM
There's no such thing as a quad or n-gon in Unity. Unity triangulates all meshes. It is possible the issue you are observing is related to Unity's automatic triangulation.
It's best to build your mesh topology in Blender as you wish, then convert all faces to triangles - in the most desirable configurations - by hand and/or with the "triangulate faces" option (and its sibling commands) in Blender's "faces" command menu. That way you control how the quad or n-gon is triangulated.
It's entirely possible that there are other issues going on for you, though. "Bumpy" isn't descriptive enough to communicate anything meaningful. If this suggestion does not resolve the issue, consider adding a video of the issue occurring, screenshots of your mesh wireframe, and a more carefully-worded description of your scenario and issue.
Best,
It occurs to me now that your project's unrealistically high gravity is likely contributing to the issue you describe. Can you explain why you have done this? What is the diameter of your golf ball in unity units?
Also worth mentioning that the best practices for modeling mesh colliders include achieving a roughly uniform distribution of vertices.
The desired vertex density is directly related to the average size of the objects that will interact with this mesh, and also to their complexity, (with the exception of primitive colliders which have a fixed complexity).
This is somewhat dangerous advice if misunderstood, but using more faces per square or cubic unit is superior for accuracy - up to a point. It is obviously inferior for performance, though. There's a "sweet spot" for topology complexity and vertex density you will get an impression of with experience. The sweet spot will change based on the project's scale and nature, but its characteristics are the same.
A truly "bulletproof" golf game will likely employ some scripted kinematics and raycast-based collision detection mechanics, due to the high velocity and small size of the projectile.
This is less true of "putting" where the ball moves slowly and is in constant contact with the environment. That's where the vertex density and clever topology is going to matter most. However, it would be impractical to model a large terrain's topology to achieve the "recommended" vertex density illustrated below in a game where the VIP is golf-ball-sized.
This is a challenging catch-22 to address, unless you're doing putt-putt (small scale, can use high density) or you're able to model the terrain in sections and utilize high-quality collision meshes only in the vicinity of the ball. Can I ask why you aren't using Unity's native Terrain system? It undoubtedly has some optimizations that address these concerns.
This diagram is by no means a perfect demonstration, nor is this general rule set in stone. It mainly applies to mesh colliders which will interact physically with rigidbodies. This is intended to illustrate the point being made, not to be used as a strict guideline:
Thank you for your very detailed reply!
Okay, I've realised why it was acting 'floaty'. I was getting the ball to be still when under a certain velocity, and as it whenever it goes airborne, there is that moment when the ball is still which had the code constantly stopping the ball making it float down. So I've removed that and the ball acts normally now. Anyway, here are the metrics of my golf ball if there's any point to knowing it: I've adjusted the metrics of my golf ball to be that of a real one; it has a mass of 0.045$$anonymous$$g (so mass is 0.045), drag is 0.87, angular drag is 1, scale is 0.042 (as a golf ball is of diameter 42mm) and diameterof sphere collider is 1. I upped the gravity after researching online mentioned that upping the gravity is the only way to make it fall realistically.
I (think I) understand what you mean about the density of vertexes relative to the object size; however I think I'll look into the Terrain system in Unity, I completely forgot it even existed. I was just focused on meshes and mesh colliders. I've put in a generic terrain from the create object menu and the ball is rolling around smoothly on it (but gravity is low so I don't know if that's contributing). If the Terrain system isn't what I'm looking for, I'll attempt finding that 'sweet spot' with triangulating meshes.
So after playing about with the Terrain system, that seems to be working well for me. As for the plane meshes, I think triangulating it the right amount works as the best solution.
Thank you for all your time and effort, I hope everyone that needs to see this will see it. :D
Your answer
Follow this Question
Related Questions
How to remove internal triangle/faces when combining mesh 0 Answers
Player Falls Over 1 Answer
Rigidbody on a basic capsule has no effect. 1 Answer
No gravity with mecanim...? 7 Answers
Horizontal Drag, no Vertical Drag 1 Answer