This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World Objects
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C++
C#
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::ObjectWaterGlobal Class

Header: #include <UnigineObjects.h>
Inherits from: Object

Interface for object water global handling. A water object represents infinitely spread water (global water) with auto-tessellation (wireframe of the water object is not scaled - regardless of the camera position it stays the same) and the underwater mode. This type is suitable to represent boundless ocean while not overloading the GPU.

However, it cannot have a body assigned, and thus does not provide proper physical interaction with scene objects. Also it is limited to a single water level. It means that the filling level of water always remains the same. So, if you need to create, for example, mountain lakes or water flows with height difference, you should use a water mesh.

See Also#

A UnigineScript API sample <UnigineSDK>/data/samples/objects/water_00

ObjectWaterGlobal Class

Members


static ObjectWaterGlobalPtr create ( ) #

Constructor. Creates a new global water object.

float getHeight ( const Math::Vec3 & position ) const#

Returns a height offset of a given point relatively to the water surface.

Arguments

  • const Math::Vec3 & position - Point position coordinates.

Return value

Height offset of the point.

Math::vec3 getNormal ( const Math::Vec3 & position ) const#

Returns a normal vector of a given point (to orient objects along the waves normals).

Arguments

  • const Math::Vec3 & position - Normal vector.

Return value

Normal vector.

void setOctaveCurrentOffset ( int index, const Math::vec3 & offset ) #

Sets new offset for an octave (heightmap sample) with given index. Global Water object can have up to 3 octaves.

Arguments

  • int index - The index of the octave (a heightmap sample).
  • const Math::vec3 & offset - An offset vector.

Math::vec3 getOctaveCurrentOffset ( int index ) const#

Returns an offset vector for an octave (heightmap sample) with given index. Global Water object can have up to 3 octaves.

Arguments

Return value

An offset vector.

int getPhysicsFieldMask ( ) const#

Returns the FieldHeight physics mask of the assigned material on the Global Water.

Return value

The FieldHeight physics mask.

int getVisualFieldMask ( ) const#

Returns the FieldHeight visual mask of the assigned material on the Global Water.

Return value

The FieldHeight visual mask.

int getWaterFieldHeightInteraction ( ) const#

Checks if the assigned material on the Global Water object has enabled FieldHeight interaction option.

Return value

1 if the FieldHeight interaction option is enabled, otherwise, 0.

float getWaterLevel ( ) const#

Returns the average Z coordinate of the water object.

Return value

The Z coordinate value.

float getWaterLevelMax ( ) const#

Returns the maximum Z coordinate of the water object.

Return value

The Z coordinate value.

float getWaterLevelMin ( ) const#

Returns the minimum Z coordinate of the water object.

Return value

The Z coordinate value.

float getWaterProceduralLevelMax ( const Math::Vec3 & position ) const#

Returns the maximum Z coordinate value of the water object including bounds of additional fields of other objects that affected Global Water heights in a given position.

Arguments

  • const Math::Vec3 & position - A position vector of additional fields.

float getWaterProceduralLevelMin ( const Math::Vec3 & position ) const#

Returns the minimum Z coordinate value of the water object including bounds of additional fields of other objects that affected Global Water heights in a given position.

Arguments

  • const Math::Vec3 & position - A position vector of additional fields.

void setWaterTime ( float time ) #

Sets water time value for water synchronization. It is used for effects, such as normals, caustics, and foam.

To make water surface immoveble, octave offset also needs to be reset:

Source code (C++)
//to be called in the update() method

water->setWaterTime(0);
for (int i = 0; i < 3; ++i)
  water->setOctaveCurrentOffset(i, vec3(0.0,0.0,0.0));

Arguments

  • float time - Water time value.

float getWaterTime ( ) const#

Returns water time value for water synchronization.

Return value

Water time value.
Last update: 16.06.2021
Build: ()