Skip to content
0.2.0-dev Download ZIP
110 lines ·6.5 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="PhysicsBody3D" inherits="CollisionObject3D" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Abstract base class for 3D game objects affected by physics.
5 </brief_description>
6 <description>
7 [PhysicsBody3D] is an abstract base class for 3D game objects affected by physics. All 3D physics bodies inherit from it.
8 [b]Warning:[/b] With a non-uniform scale, this node will likely not behave as expected. It is advised to keep its scale the same on all axes and adjust its collision shape(s) instead.
9 </description>
10 <tutorials>
11 <link title="Physics introduction">$DOCS_URL/tutorials/physics/physics_introduction.html</link>
12 <link title="Troubleshooting physics issues">$DOCS_URL/tutorials/physics/troubleshooting_physics_issues.html</link>
13 </tutorials>
14 <methods>
15 <method name="add_collision_exception_with">
16 <return type="void" />
17 <param index="0" name="body" type="Node" />
18 <description>
19 Adds a body to the list of bodies that this body can't collide with.
20 </description>
21 </method>
22 <method name="get_axis_lock" qualifiers="const">
23 <return type="bool" />
24 <param index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis" />
25 <description>
26 Returns [code]true[/code] if the specified linear or rotational [param axis] is locked.
27 </description>
28 </method>
29 <method name="get_collision_exceptions">
30 <return type="PhysicsBody3D[]" />
31 <description>
32 Returns an array of nodes that were added as collision exceptions for this body.
33 </description>
34 </method>
35 <method name="get_gravity" qualifiers="const">
36 <return type="Vector3" />
37 <description>
38 Returns the gravity vector computed from all sources that can affect the body, including all gravity overrides from [Area3D] nodes and the global world gravity.
39 </description>
40 </method>
41 <method name="move_and_collide">
42 <return type="KinematicCollision3D" />
43 <param index="0" name="motion" type="Vector3" />
44 <param index="1" name="test_only" type="bool" default="false" />
45 <param index="2" name="safe_margin" type="float" default="0.001" />
46 <param index="3" name="recovery_as_collision" type="bool" default="false" />
47 <param index="4" name="max_collisions" type="int" default="1" />
48 <description>
49 Moves the body along the vector [param motion]. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code].
50 The body will stop if it collides. Returns a [KinematicCollision3D], which contains information about the collision when stopped, or when touching another body along the motion.
51 If [param test_only] is [code]true[/code], the body does not move but the would-be collision information is given.
52 [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody3D.safe_margin] for more details).
53 If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is used e.g. by [CharacterBody3D] for improving floor detection during floor snapping.
54 [param max_collisions] allows to retrieve more than one collision result.
55 </description>
56 </method>
57 <method name="remove_collision_exception_with">
58 <return type="void" />
59 <param index="0" name="body" type="Node" />
60 <description>
61 Removes a body from the list of bodies that this body can't collide with.
62 </description>
63 </method>
64 <method name="set_axis_lock">
65 <return type="void" />
66 <param index="0" name="axis" type="int" enum="PhysicsServer3D.BodyAxis" />
67 <param index="1" name="lock" type="bool" />
68 <description>
69 Locks or unlocks the specified linear or rotational [param axis] depending on the value of [param lock].
70 </description>
71 </method>
72 <method name="test_move" keywords="check, collision, sweep">
73 <return type="bool" />
74 <param index="0" name="from" type="Transform3D" />
75 <param index="1" name="motion" type="Vector3" />
76 <param index="2" name="collision" type="KinematicCollision3D" default="null" />
77 <param index="3" name="safe_margin" type="float" default="0.001" />
78 <param index="4" name="recovery_as_collision" type="bool" default="false" />
79 <param index="5" name="max_collisions" type="int" default="1" />
80 <description>
81 Checks for collisions without moving the body. In order to be frame rate independent in [method Node._physics_process] or [method Node._process], [param motion] should be computed using [code]delta[/code].
82 Virtually sets the node's position, scale and rotation to that of the given [Transform3D], then tries to move the body along the vector [param motion]. Returns [code]true[/code] if a collision would stop the body from moving along the whole path.
83 [param collision] is an optional object of type [KinematicCollision3D], which contains additional information about the collision when stopped, or when touching another body along the motion.
84 [param safe_margin] is the extra margin used for collision recovery (see [member CharacterBody3D.safe_margin] for more details).
85 If [param recovery_as_collision] is [code]true[/code], any depenetration from the recovery phase is also reported as a collision; this is useful for checking whether the body would [i]touch[/i] any other bodies.
86 [param max_collisions] allows to retrieve more than one collision result.
87 </description>
88 </method>
89 </methods>
90 <members>
91 <member name="axis_lock_angular_x" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
92 Lock the body's rotation in the X axis.
93 </member>
94 <member name="axis_lock_angular_y" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
95 Lock the body's rotation in the Y axis.
96 </member>
97 <member name="axis_lock_angular_z" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
98 Lock the body's rotation in the Z axis.
99 </member>
100 <member name="axis_lock_linear_x" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
101 Lock the body's linear movement in the X axis.
102 </member>
103 <member name="axis_lock_linear_y" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
104 Lock the body's linear movement in the Y axis.
105 </member>
106 <member name="axis_lock_linear_z" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
107 Lock the body's linear movement in the Z axis.
108 </member>
109 </members>
110</class>