Blender GE wave plug-in provides ability to create and manage waves in realtime. It also supports floating objects on waves. To allow efficient calculation of waves it can use separate thread.
Wave plug-in was used in game Power of will.
There are binaries for Blender 2.49a on Windows XP or Vista. Store it to game folder to install it.
Plug-in is published as open source with GPL. There are sources of plug-in.
Finally, there is demo with waves and floating object.
blendWave plug-in is specialized mesh manipulation tool providing realtime waves animation. It uses existing mesh, waves are created in object’s local XY plane. Plug-in creates circular waves. Each wave can have different parameters, these are set during wave creation and are valid until its end. When waves meet, their effects are added.
This class covers basic functionality of waves – calculates mesh animation for every vertex, stores waves and wave generators (emiters).
Class constructor has 3 parameters:
- mesh – object of class KX_MeshProxy (got from game object using method getMesh());
- materialID – material index to specify submesh used for animation, default is 0
- useThread – separate thread for wave calculation, yes = 1, no = 0, default is 0. Doing calculation in separate thread improves performance, especially on multicore processors
- emiters – list of wave emiters. This attribute can be set by a list of emiter objects and allows access to list items. Attribute doesn’t support list interface, so it’s not possible to add or delete items (it can be done by copying list to variable)
- update (actTime) – performs wave calculation and sets vertex positions for time provided as parameter
- getPosNorm (posX, posY) – calculates position and normal vector for coordinates passed as parameters. Method returns two 3d vectors – the first is wave position, the second is normal vector. It can be used for simulation of floating objects
- getForce (posX, posY) – calculates horizontal force caused by waves on specified coordinates. Method returns 2d force vector in XY plane, its value depends on wave direction, position and amplitude
Objects of this class control waves creation and parameters of created waves. Emiter contains actual wave data and sets them to wave when it’s created.
- position – emiter’s position relative to the center of the mesh to be waved. It’s 2D vector (without Z coordinate)
- range – range of wave, distance from emiter how far wave reaches
- length – length of wave from its front edge to back edge
- speed – speed of wave from its origin, default value is 1.0
- amplitude – wave height (applied together with wave envelope and its shape); default value is 1.0
- frontEdge – size of front edge smoothing area. It adapts normals to provide smooth transition to wave normal vectors. Value must be in range <0.0, backEdge)
- backEdge – size of back edge smoothing area. It adapts normals to provide smooth transition to wave normal vectors. Value must be in rangee (frontEdge, 1.0>
- shape – defines shape of a wave. It’s a list of 2D points describing wave shape for points regularly destributes in range <0.0, 1.0). Default shape is sinusoid starting at lowest point (angle = Pi)
- envelope – wave envelope defines height of wave as it spreads in its range. It’s a list of 2D points, where x coordinate defines distance from origin and y coordinate defines height of wave (together with amplitude)
- repeat – bool value to specify, if creation of wave is automatically repeated
- createWave (pos) – creates wave with parameters set to emiter and distance from emiter center defined in parameter pos