class_kinematicbody.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_KinematicBody:
  4. KinematicBody
  5. =============
  6. **Inherits:** :ref:`PhysicsBody<class_physicsbody>` **<** :ref:`CollisionObject<class_collisionobject>` **<** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Kinematic body 3D node.
  11. Member Functions
  12. ----------------
  13. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`Vector3<class_vector3>` | :ref:`get_floor_velocity<class_KinematicBody_get_floor_velocity>` **(** **)** const |
  15. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`float<class_float>` | :ref:`get_safe_margin<class_KinematicBody_get_safe_margin>` **(** **)** const |
  17. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`KinematicCollision<class_kinematiccollision>` | :ref:`get_slide_collision<class_KinematicBody_get_slide_collision>` **(** :ref:`int<class_int>` slide_idx **)** |
  19. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`int<class_int>` | :ref:`get_slide_count<class_KinematicBody_get_slide_count>` **(** **)** const |
  21. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`is_on_ceiling<class_KinematicBody_is_on_ceiling>` **(** **)** const |
  23. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_on_floor<class_KinematicBody_is_on_floor>` **(** **)** const |
  25. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_on_wall<class_KinematicBody_is_on_wall>` **(** **)** const |
  27. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`KinematicCollision<class_kinematiccollision>` | :ref:`move_and_collide<class_KinematicBody_move_and_collide>` **(** :ref:`Vector3<class_vector3>` rel_vec **)** |
  29. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :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 **)** |
  31. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_safe_margin<class_KinematicBody_set_safe_margin>` **(** :ref:`float<class_float>` pixels **)** |
  33. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`test_move<class_KinematicBody_test_move>` **(** :ref:`Transform<class_transform>` from, :ref:`Vector3<class_vector3>` rel_vec **)** |
  35. +------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. Member Variables
  37. ----------------
  38. - :ref:`float<class_float>` **collision/safe_margin**
  39. Description
  40. -----------
  41. 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:
  42. 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).
  43. 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.
  44. Member Function Description
  45. ---------------------------
  46. .. _class_KinematicBody_get_floor_velocity:
  47. - :ref:`Vector3<class_vector3>` **get_floor_velocity** **(** **)** const
  48. .. _class_KinematicBody_get_safe_margin:
  49. - :ref:`float<class_float>` **get_safe_margin** **(** **)** const
  50. .. _class_KinematicBody_get_slide_collision:
  51. - :ref:`KinematicCollision<class_kinematiccollision>` **get_slide_collision** **(** :ref:`int<class_int>` slide_idx **)**
  52. .. _class_KinematicBody_get_slide_count:
  53. - :ref:`int<class_int>` **get_slide_count** **(** **)** const
  54. .. _class_KinematicBody_is_on_ceiling:
  55. - :ref:`bool<class_bool>` **is_on_ceiling** **(** **)** const
  56. .. _class_KinematicBody_is_on_floor:
  57. - :ref:`bool<class_bool>` **is_on_floor** **(** **)** const
  58. .. _class_KinematicBody_is_on_wall:
  59. - :ref:`bool<class_bool>` **is_on_wall** **(** **)** const
  60. .. _class_KinematicBody_move_and_collide:
  61. - :ref:`KinematicCollision<class_kinematiccollision>` **move_and_collide** **(** :ref:`Vector3<class_vector3>` rel_vec **)**
  62. .. _class_KinematicBody_move_and_slide:
  63. - :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 **)**
  64. .. _class_KinematicBody_set_safe_margin:
  65. - void **set_safe_margin** **(** :ref:`float<class_float>` pixels **)**
  66. .. _class_KinematicBody_test_move:
  67. - :ref:`bool<class_bool>` **test_move** **(** :ref:`Transform<class_transform>` from, :ref:`Vector3<class_vector3>` rel_vec **)**