class_kinematicbody.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the KinematicBody.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_KinematicBody:
  5. KinematicBody
  6. =============
  7. **Inherits:** :ref:`PhysicsBody<class_physicsbody>` **<** :ref:`CollisionObject<class_collisionobject>` **<** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Kinematic body 3D node.
  12. Member Functions
  13. ----------------
  14. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Vector3<class_vector3>` | :ref:`get_floor_velocity<class_KinematicBody_get_floor_velocity>` **(** **)** const |
  16. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`float<class_float>` | :ref:`get_safe_margin<class_KinematicBody_get_safe_margin>` **(** **)** const |
  18. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`KinematicCollision<class_kinematiccollision>` | :ref:`get_slide_collision<class_KinematicBody_get_slide_collision>` **(** :ref:`int<class_int>` slide_idx **)** |
  20. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_slide_count<class_KinematicBody_get_slide_count>` **(** **)** const |
  22. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`is_on_ceiling<class_KinematicBody_is_on_ceiling>` **(** **)** const |
  24. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`is_on_floor<class_KinematicBody_is_on_floor>` **(** **)** const |
  26. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`is_on_wall<class_KinematicBody_is_on_wall>` **(** **)** const |
  28. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`KinematicCollision<class_kinematiccollision>` | :ref:`move_and_collide<class_KinematicBody_move_and_collide>` **(** :ref:`Vector3<class_vector3>` rel_vec **)** |
  30. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Vector3<class_vector3>` | :ref:`move_and_slide<class_KinematicBody_move_and_slide>` **(** :ref:`Vector3<class_vector3>` linear_velocity, :ref:`Vector3<class_vector3>` floor_normal=Vector3( 0, 0, 0 ), :ref:`float<class_float>` slope_stop_min_velocity=0.05, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398 **)** |
  32. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_safe_margin<class_KinematicBody_set_safe_margin>` **(** :ref:`float<class_float>` pixels **)** |
  34. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`test_move<class_KinematicBody_test_move>` **(** :ref:`Transform<class_transform>` from, :ref:`Vector3<class_vector3>` rel_vec **)** |
  36. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. Member Variables
  38. ----------------
  39. - :ref:`float<class_float>` **collision/safe_margin**
  40. Description
  41. -----------
  42. Kinematic bodies are special types of bodies that are meant to be user-controlled. They are not affected by physics at all (to other types of bodies, such a character or a rigid body, these are the same as a static body). They have however, two main uses:
  43. Simulated Motion: When these bodies are moved manually, either from code or from an AnimationPlayer (with process mode set to fixed), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
  44. Kinematic Characters: KinematicBody also has an api for moving objects (the :ref:`move<class_KinematicBody_move>` method) while performing collision tests. This makes them really useful to implement characters that collide against a world, but that don't require advanced physics.
  45. Member Function Description
  46. ---------------------------
  47. .. _class_KinematicBody_get_floor_velocity:
  48. - :ref:`Vector3<class_vector3>` **get_floor_velocity** **(** **)** const
  49. .. _class_KinematicBody_get_safe_margin:
  50. - :ref:`float<class_float>` **get_safe_margin** **(** **)** const
  51. .. _class_KinematicBody_get_slide_collision:
  52. - :ref:`KinematicCollision<class_kinematiccollision>` **get_slide_collision** **(** :ref:`int<class_int>` slide_idx **)**
  53. .. _class_KinematicBody_get_slide_count:
  54. - :ref:`int<class_int>` **get_slide_count** **(** **)** const
  55. .. _class_KinematicBody_is_on_ceiling:
  56. - :ref:`bool<class_bool>` **is_on_ceiling** **(** **)** const
  57. .. _class_KinematicBody_is_on_floor:
  58. - :ref:`bool<class_bool>` **is_on_floor** **(** **)** const
  59. .. _class_KinematicBody_is_on_wall:
  60. - :ref:`bool<class_bool>` **is_on_wall** **(** **)** const
  61. .. _class_KinematicBody_move_and_collide:
  62. - :ref:`KinematicCollision<class_kinematiccollision>` **move_and_collide** **(** :ref:`Vector3<class_vector3>` rel_vec **)**
  63. .. _class_KinematicBody_move_and_slide:
  64. - :ref:`Vector3<class_vector3>` **move_and_slide** **(** :ref:`Vector3<class_vector3>` linear_velocity, :ref:`Vector3<class_vector3>` floor_normal=Vector3( 0, 0, 0 ), :ref:`float<class_float>` slope_stop_min_velocity=0.05, :ref:`int<class_int>` max_slides=4, :ref:`float<class_float>` floor_max_angle=0.785398 **)**
  65. .. _class_KinematicBody_set_safe_margin:
  66. - void **set_safe_margin** **(** :ref:`float<class_float>` pixels **)**
  67. .. _class_KinematicBody_test_move:
  68. - :ref:`bool<class_bool>` **test_move** **(** :ref:`Transform<class_transform>` from, :ref:`Vector3<class_vector3>` rel_vec **)**