Smoothing Meshes

“Do as I say, not as I do.”

OK, I’m working, if you could call it that, on an anti-gravity racing game, similar to Wipeout. I’m having a devil of a time getting the vehicle to work correctly. The main problem is that it’s jerky, and, since it gets its rotation from the track normal, that could be expected. The problem, then, is how to smooth it. I’ve been wrestling with this problem for weeks (on and off) and still cannot figure out how to make an object follow a non-smooth track as if it were smooth.

Any thoughts? Even being told which tree to bark up might be a big help…

RaycastHit.barycentricCoordinate is probably what you want to look at, if you’re using raycasting to get the normal.

–Eric

Thanks for the quick reply, but I don’t immediately see how that is useful. My current approach just takes hitData.normal to get the normal. I can see how it would be useful when interpolating normals of adjacent triangles, though.
Interpolating the triangles of the track to give the script smooth input was something I thought of, but I don’t have any clue of how to go about actually implementing it…

I think the code example in the docs illustrates the use pretty well; use that instead of hitData.normal. Maybe, in the last line, use “interpolatedNormal*10” or *20 or something, so you can more easily see what’s happening.

–Eric

My bad. I found that page out of curiosity a few days ago and, skimming it, came to the conclusion that it displayed the normal line from the center of the triangle, like Blender does.
Now, after re-reading the script, and outright trying it, I see what you were talking about. Thank you!

Now I only wish I had something to offer you in return aside from warm fuzzies…

A large quantity of small unmarked bills would be fine. Thanks!

–Eric

One more question… I still have jerkiness, but I traced it to the camera, not the vehicle (which works flawlessly now!). Eric, or anyone else, can your wisdom point out whytransform.position = Vector3.Lerp(transform.position,target.position,Time.deltaTime * transformDamping);does not produce a smooth following behavior? I’ve tried using fixed values for the time, heck, I’ve even tried having it follow a cube moving at a fixed 1/m/sec, and it still looks like the object in question is having some kind of seizure.

You can try making the object use interpolation or extrapolation. I’ve found that having the camera on FixedUpdate works best though.

–Eric