Background: I’m creating a 2D side view golf game. I’m designing the levels in the Tiled Map Editor, and dynamically creating the level using chunk style dynamic meshes (a new mesh is created for every 5x5 tile grid). I have this all working fine so far (mostly!).
For reference, you can check out my web demo here (water is located top-left, and lower middle):
https://dl.dropbox.com/u/1979274/CubeGolf/WebPlayer/WebPlayer.html
(Just click in the direction you want the ball to go, the further from the ball, the more force, and you can click again before the ball rests, just a temp mode for developing)
I have my water tiles being generated using a water prefab, instantiating whenever the level has a ‘water tile’ entry. In this prefab I have a start script to dynamically create 8 sub water slices (per tile) as separate game objects. Then each update I change each slice’s scale to follow a sine wave pattern to make it look like an animated wave. Kinda cool, but VERY inefficient. I just wanted to get it coded and see. Plus it looks funky where the water slices meet, as the slices are sharing the same coordinates, and/or sometimes has a gap.
The problem is that I suck with 3d modeling, so went the dynamic mesh route. Ideally I suppose I would use an animated model for the water, but then I loose the flexibility to dynamically change the water animation (more amplitude for more wind, etc), plus I suck at modeling / animation.
I think I want to get away from the slices look, and change it to more of a surface curve look, without the dividing faces, just top and front.
Is there a way to create an animated model / mesh dynamically? Does animation NEED bones?
Or, I may just create a new mesh each frame, but want to share it amongst all water model instances. Is there a way for multiple models to share the same mesh data? (without having to update each model each frame to use the same source mesh detail arrays?). Like, have a routine calculate this frame’s water shape (somehow before the water object code activates, gotta look up code execution order!) and store this info globally. Dang, now I’m rambling! The water tiles should start and end at the same height so they tile together nicely.
I appreciate any help, thanks.