godot_voxel/doc/classes/VoxelBoxMover.xml

77 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelBoxMover" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
<brief_description>
</brief_description>
<description>
Utility class allowing to reproduce simple move-and-slide logic using only voxel AABBs, similar to Minecraft physics. This class may only be used with blocky voxels.
Store an instance of it within a member variable of your script, and use it within [method Node._process] or [method Node._physics_process] (it works wherever you like).
[codeblock]
var motion = Vector3(0, 0, -10 * delta) # Move forward
motion = _box_mover.get_motion(get_translation(), motion, aabb, terrain_node)
global_translate(motion)
[/codeblock]
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_collision_mask" qualifiers="const">
<return type="int" />
<description>
Gets the collision mask used to detect collidable voxels.
This collision mask is specific to this collision system, and is defined in [member VoxelBlockyModel.collision_mask].
</description>
</method>
<method name="get_max_step_height" qualifiers="const">
<return type="float" />
<description>
</description>
</method>
<method name="get_motion">
<return type="Vector3" />
<param index="0" name="pos" type="Vector3" />
<param index="1" name="motion" type="Vector3" />
<param index="2" name="aabb" type="AABB" />
<param index="3" name="terrain" type="Node" />
<description>
Given a motion vector, returns a modified vector telling you by how much to move your character. This is similar to [method KinematicBody.move_and_slide], except you have to apply the movement.
</description>
</method>
<method name="has_stepped_up" qualifiers="const">
<return type="bool" />
<description>
When step climbing is enabled, tells when the last call to [method get_motion] caused climbing to occur.
Climbing modifies the motion vector upwards so that the body is snapped on top of the step. This can have implications in character controller code, such as considering the character to be on the floor instead of having jumped.
</description>
</method>
<method name="is_step_climbing_enabled" qualifiers="const">
<return type="bool" />
<description>
Tells if step climbing is enabled.
</description>
</method>
<method name="set_collision_mask">
<return type="void" />
<param index="0" name="mask" type="int" />
<description>
Sets the collision mask used to detect collidable voxels.
Only voxels sharing at least one bit between the masks will be detected.
This collision mask is specific to this collision system, and is defined in [member VoxelBlockyModel.collision_mask].
</description>
</method>
<method name="set_max_step_height">
<return type="void" />
<param index="0" name="height" type="float" />
<description>
Sets the maximum height that can be climbed like "stairs".
</description>
</method>
<method name="set_step_climbing_enabled">
<return type="void" />
<param index="0" name="enabled" type="bool" />
<description>
When enabled, [method get_motion] will attempt to climb up small steps. This allows to implement Minecraft-like stairs.
</description>
</method>
</methods>
</class>