godot_voxel/doc/source/api/VoxelBoxMover.md
2021-02-16 20:54:45 +00:00

3.8 KiB

VoxelBoxMover

Inherits: Reference

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).

var motion = Vector3(0, 0, -10 * delta) # Move forward
motion = _box_mover.get_motion(get_translation(), motion, aabb, terrain_node)
global_translate(motion)

Methods:

Return Signature
int get_collision_mask ( ) const
Vector3 get_motion ( Vector3 pos, Vector3 motion, AABB aabb, Node terrain )
void set_collision_mask ( int mask )

Method Descriptions

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.

  • void set_collision_mask( int mask )

Generated on Feb 16, 2021