# Unigine::PhysicalWater Class

A PhysicalWater class is used to simulate water interaction effects.

Notice
The water will affect only objects, to which a cloth body or a rigid body are assigned. If the rigid body is used, a shape should be also assigned.

• An article on Physical Water
• A set of samples located in the data/samples/physicals folder:
1. water_00
2. water_01

## static PhysicalWaterPtr create ( const Math::vec3 & size )

Constructor. Creates a physical water node of the specified size.

### Arguments

• const Math::vec3 & size - Water box size in units.

## Ptr<PhysicalWater>cast( const Ptr<Node> & node )

Casts a PhysicalWater out of the Node instance.

### Arguments

• const Ptr<Node> & node - Pointer to Node.

### Return value

Pointer to PhysicalWater.

## Ptr<PhysicalWater>cast( const Ptr<Physical> & base )

Casts a PhysicalWater out of the Physical instance.

### Arguments

• const Ptr<Physical> & base - Pointer to Physical.

### Return value

Pointer to PhysicalWater.

## voidsetAngularDamping( float damping )

Sets a value indicating how much the angular velocity of the objects decreases when they get into the physical water.

### Arguments

• float damping - An angular damping value. If a negative value is provided, 0 will be used instead.

## floatgetAngularDamping( )

Returns the current value indicating how much the angular velocity of the objects decreases when they get into the physical water.

### Return value

The angular damping value.

## Ptr<Body>getContactBody( int num )

Returns the body of the object by the given contact with physical water.

### Arguments

• int num - Contact number.

### Return value

Body of the object.

## floatgetContactDepth( int num )

Returns the depth of the object submergence by the given contact.

### Arguments

• int num - Contact number.

### Return value

Depth of object submergence in units.

## Math::vec3getContactForce( int num )

Returns the force in the point of a given contact.

### Arguments

• int num - Contact number.

Force value.

## Math::Vec3getContactPoint( int num )

Returns the coordinates of the contact point.

### Arguments

• int num - Contact number.

### Return value

Contact point coordinates.

## Math::vec3getContactVelocity( int num )

Returns the relative velocity between the object and the physical water.

### Arguments

• int num - Contact number.

### Return value

Relative velocity in units per second.

## voidsetDensity( float density )

Sets a density of the water that determines objects buoyancy.

### Arguments

• float density - A density value. If a negative value is provided, 0 will be used instead.

## floatgetDensity( )

Returns the current density of the physical water that determines objects buoyancy.

### Return value

The density value.

## voidsetLinearDamping( float damping )

Sets a value indicating how much the linear velocity of the objects decreases when they get into the physical water.

### Arguments

• float damping - A linear damping value. If a negative value is provided, 0 will be used instead.

## floatgetLinearDamping( )

Returns the current value indicating how much the linear velocity of the objects decreases when they get into the physical water.

### Return value

The linear damping value.

## intgetNumContacts( )

Returns the number of contacts between the physical water and the objects.

### Return value

Number of contacts.

## voidsetSize( const Math::vec3 & size )

Sets a size of the physical water node.

### Arguments

• const Math::vec3 & size - A size of the water box in units. If a negative value is provided, 0 will be used instead.

## Math::vec3getSize( )

Returns the current size of the physical water node.

### Return value

The size of the water box in units.

## voidsetVelocity( const Math::vec3 & velocity )

Sets a velocity of the flow in physical water.

### Arguments

• const Math::vec3 & velocity - A velocity in units per second.

## Math::vec3getVelocity( )

Returns the current velocity of the flow in physical water.

### Return value

The velocity in units per second.

## inttype( )

Returns the type of the node.

### Return value

Physical type identifier.
Last update: 2018-12-27