Skip to content

Commit

Permalink
Update documentation and flow_direction property.
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Oct 28, 2023
1 parent 57ca46d commit bf6b7eb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc_classes/HydroRigidBody.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="HydroRigidBody" inherits="RigidBody3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="HydroRigidBody" inherits="RigidBody3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
A RigidBody3D with buoyancy and other related forces when it is inside a [WaterArea3D].
</brief_description>
Expand Down
19 changes: 15 additions & 4 deletions doc_classes/WaterArea3D.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WaterArea3D" inherits="Area3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="WaterArea3D" inherits="Area3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Defines an area in which a [HydroRigidBody] will be affected by buoyancy and related forces.
</brief_description>
Expand All @@ -10,13 +10,24 @@
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_flow_direction">
<return type="Vector3" />
<param index="0" name="point" type="Vector3" />
<description>
</description>
</method>
<method name="set_flow_direction">
<return type="void" />
<param index="0" name="flow_direction" type="Vector3" />
<description>
</description>
</method>
</methods>
<members>
<member name="density" type="float" setter="set_density" getter="get_density" default="1000.0">
Sets the density of the water in this area. Freshwater is 1000 kg/m^3, and seawater ranges from 1020 - 1029 kg/m^3.
</member>
<member name="flow_direction" type="Vector3" setter="set_flow_direction" getter="get_flow_direction" default="Vector3(0, 0, 0)">
Creates a uniform current running through the area in the specified direction. Any object submerged in this area will be pushed in the direction of the current.
</member>
<member name="viscosity" type="float" setter="set_viscosity" getter="get_viscosity" default="1.0">
Adjusts the viscosity of the water in this area. This value changes the resistance to motion through the fluid without affecting buoyancy. The default value of 1.0 is a good starting point for water; for thicker substances such as maple syrup or lava try increasing the value.
</member>
Expand Down
2 changes: 1 addition & 1 deletion doc_classes/WatercraftBallast.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WatercraftBallast" inherits="Node3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="WatercraftBallast" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Allows off-center weight to be added to a [HydroRigidBody]
</brief_description>
Expand Down
2 changes: 1 addition & 1 deletion doc_classes/WatercraftPropulsion.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WatercraftPropulsion" inherits="Node3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="WatercraftPropulsion" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Adds a propulsion system to a [HydroRigidBody]
</brief_description>
Expand Down
2 changes: 1 addition & 1 deletion doc_classes/WatercraftRudder.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WatercraftRudder" inherits="Node3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<class name="WatercraftRudder" inherits="Node3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
Adds a steerable rudder to a [HydroRigidBody].
</brief_description>
Expand Down
4 changes: 1 addition & 3 deletions src/water_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void WaterArea3D::_bind_methods() {
&WaterArea3D::get_water_height);
ClassDB::bind_method(D_METHOD("set_flow_direction", "flow_direction"),
&WaterArea3D::set_flow_direction);
ClassDB::bind_method(D_METHOD("get_flow_direction"),
ClassDB::bind_method(D_METHOD("get_flow_direction", "point"),
&WaterArea3D::get_flow_direction);
ClassDB::bind_method(D_METHOD("_body_entered", "node"),
&WaterArea3D::_body_entered);
Expand All @@ -86,8 +86,6 @@ void WaterArea3D::_bind_methods() {
"get_viscosity");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "water_height"), "set_water_height",
"get_water_height");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "flow_direction"),
"set_flow_direction", "get_flow_direction");
}

void WaterArea3D::_notification(int p_what) {
Expand Down

0 comments on commit bf6b7eb

Please sign in to comment.