- Home /
How to avoid Camera jerk when mesh count increases ????
Hi, iam trying to make a game like ski safari, using the dynamically created 2D terrain for the player to slide. The 2D terrain which iam creating has a mesh count fluctuating from 200 to 500, there is a camera jerk when the mesh count suddenly increases from 200 to 500.. How to minimize this ?? Draw calls count is also very less around 10 still there is a jerk.. How to overcome this?
Is it jerking because the normal of the surface is changing? Can you post your movement code?
its jerking because the terrain mesh count is not stable once it will be around 200 and suddenly it increases to 500 when the terrain changes after the camera has passed it.. http://www.youtube.com/watch?v=nPX8dw283X4 i am using this logic for creating the terrain..
Interesting. For anyone else reading your question, you are using a collider. I'd assumed you were doing raycasting and the issues with the discontinuity in the two meshes. Also if there is a point in the video that shows the jerk, it would be helpful to give a time offset. I gave in $$anonymous$$ute four. Have you looked in the profiler? Is there a spike at the point you get the jerk?
yes only when there is shifting o mesh collider that is terrain there is a spike. How can i avoid this ?? How can i use ray casting for creating terrain ??
You need to find the specific cause for your jerk. If it is a performance spike, then you need to figure out a way to smooth things out. Perhaps the collier needs to get added in a different frame than the mesh is built for example. Or maybe when the detail is increased, the segment length is decreased to keep the mesh count more even. If you have pro, take a look at where your apps is spending its time when transition between meshes.
If on the other hand the issue is related to a discontinuity between the two meshes...then you need to look at other solutions.
The raycasting is a non issue unless your calculation for the positioning of the meshes is off. When you first asked your question, I was visualizing an character moving over the surface with the character's up matching the normal of the surface and the jerk being caused by an unexpected normal at the transition.