Skip to content
0.2.0-dev Download ZIP
93 lines ·3.4 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="KinematicCollision2D" inherits="RefCounted" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Holds collision data from the movement of a [PhysicsBody2D].
5 </brief_description>
6 <description>
7 Holds collision data from the movement of a [PhysicsBody2D], usually from [method PhysicsBody2D.move_and_collide]. When a [PhysicsBody2D] is moved, it stops if it detects a collision with another body. If a collision is detected, a [KinematicCollision2D] object is returned.
8 The collision data includes the colliding object, the remaining motion, and the collision position. This data can be used to determine a custom response to the collision.
9 </description>
10 <tutorials>
11 </tutorials>
12 <methods>
13 <method name="get_angle" qualifiers="const">
14 <return type="float" />
15 <param index="0" name="up_direction" type="Vector2" default="Vector2(0, -1)" />
16 <description>
17 Returns the collision angle according to [param up_direction], which is [constant Vector2.UP] by default. This value is always positive.
18 </description>
19 </method>
20 <method name="get_collider" qualifiers="const">
21 <return type="Object" />
22 <description>
23 Returns the colliding body's attached [Object].
24 </description>
25 </method>
26 <method name="get_collider_id" qualifiers="const">
27 <return type="int" />
28 <description>
29 Returns the unique instance ID of the colliding body's attached [Object]. See [method Object.get_instance_id].
30 </description>
31 </method>
32 <method name="get_collider_rid" qualifiers="const">
33 <return type="RID" />
34 <description>
35 Returns the colliding body's [RID] used by the [PhysicsServer2D].
36 </description>
37 </method>
38 <method name="get_collider_shape" qualifiers="const">
39 <return type="Object" />
40 <description>
41 Returns the colliding body's shape.
42 </description>
43 </method>
44 <method name="get_collider_shape_index" qualifiers="const">
45 <return type="int" />
46 <description>
47 Returns the colliding body's shape index. See [CollisionObject2D].
48 </description>
49 </method>
50 <method name="get_collider_velocity" qualifiers="const">
51 <return type="Vector2" />
52 <description>
53 Returns the colliding body's velocity.
54 </description>
55 </method>
56 <method name="get_depth" qualifiers="const">
57 <return type="float" />
58 <description>
59 Returns the colliding body's length of overlap along the collision normal.
60 </description>
61 </method>
62 <method name="get_local_shape" qualifiers="const">
63 <return type="Object" />
64 <description>
65 Returns the moving object's colliding shape.
66 </description>
67 </method>
68 <method name="get_normal" qualifiers="const">
69 <return type="Vector2" />
70 <description>
71 Returns the colliding body's shape's normal at the point of collision.
72 </description>
73 </method>
74 <method name="get_position" qualifiers="const">
75 <return type="Vector2" />
76 <description>
77 Returns the point of collision in global coordinates.
78 </description>
79 </method>
80 <method name="get_remainder" qualifiers="const">
81 <return type="Vector2" />
82 <description>
83 Returns the moving object's remaining movement vector.
84 </description>
85 </method>
86 <method name="get_travel" qualifiers="const">
87 <return type="Vector2" />
88 <description>
89 Returns the moving object's travel before collision.
90 </description>
91 </method>
92 </methods>
93</class>