aboutsummaryrefslogtreecommitdiff
path: root/servers/physics_server.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2018-01-12 09:00:20 +0100
committerGitHub2018-01-12 09:00:20 +0100
commite24f2c6489afdccc6268008d3dcc1ff4ad8ea71c (patch)
treeee8faddef95f8bcb66acfce729a6f85513740b2d /servers/physics_server.cpp
parent00630479dd5e5aa95915fddf7df9c6b11f525b0e (diff)
parentad79c703008394a360eb9875196a9414e1c84585 (diff)
downloadgodot-e24f2c6489afdccc6268008d3dcc1ff4ad8ea71c.tar.gz
godot-e24f2c6489afdccc6268008d3dcc1ff4ad8ea71c.tar.zst
godot-e24f2c6489afdccc6268008d3dcc1ff4ad8ea71c.zip
Merge pull request #15611 from bojidar-bg/x-bind-more-properties
Bind many more properties to scripts
Diffstat (limited to '')
-rw-r--r--servers/physics_server.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index 95875d216..9d4807fcf 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -113,6 +113,19 @@ void PhysicsDirectBodyState::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_step"), &PhysicsDirectBodyState::get_step);
ClassDB::bind_method(D_METHOD("integrate_forces"), &PhysicsDirectBodyState::integrate_forces);
ClassDB::bind_method(D_METHOD("get_space_state"), &PhysicsDirectBodyState::get_space_state);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "step"), "", "get_step");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "inverse_mass"), "", "get_inverse_mass");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "total_angular_damp"), "", "get_total_angular_damp");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "total_linear_damp"), "", "get_total_linear_damp");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "inverse_inertia"), "", "get_inverse_inertia");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "total_gravity"), "", "get_total_gravity");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "center_of_mass"), "", "get_center_of_mass");
+ ADD_PROPERTY(PropertyInfo(Variant::BASIS, "principal_inertia_axes"), "", "get_principal_inertia_axes");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "angular_velocity"), "set_angular_velocity", "get_angular_velocity");
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "linear_velocity"), "set_linear_velocity", "get_linear_velocity");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sleeping"), "set_sleep_state", "is_sleeping");
+ ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform"), "set_transform", "get_transform");
}
PhysicsDirectBodyState::PhysicsDirectBodyState() {}
@@ -198,6 +211,13 @@ void PhysicsShapeQueryParameters::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_exclude", "exclude"), &PhysicsShapeQueryParameters::set_exclude);
ClassDB::bind_method(D_METHOD("get_exclude"), &PhysicsShapeQueryParameters::get_exclude);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "exclude", PROPERTY_HINT_NONE, itos(Variant::_RID) + ":"), "set_exclude", "get_exclude");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin");
+ //ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", ""); // FIXME: Lacks a getter
+ ADD_PROPERTY(PropertyInfo(Variant::_RID, "shape_rid"), "set_shape_rid", "get_shape_rid");
+ ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
}
PhysicsShapeQueryParameters::PhysicsShapeQueryParameters() {