summaryrefslogtreecommitdiff
path: root/servers/physics_server_2d.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/physics_server_2d.h')
-rw-r--r--servers/physics_server_2d.h56
1 files changed, 35 insertions, 21 deletions
diff --git a/servers/physics_server_2d.h b/servers/physics_server_2d.h
index 2bff8f5dcb..e9faf0a3bf 100644
--- a/servers/physics_server_2d.h
+++ b/servers/physics_server_2d.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -64,13 +64,24 @@ public:
virtual Vector2 get_velocity_at_local_position(const Vector2 &p_position) const = 0;
- virtual void add_central_force(const Vector2 &p_force) = 0;
- virtual void add_force(const Vector2 &p_force, const Vector2 &p_position = Vector2()) = 0;
- virtual void add_torque(real_t p_torque) = 0;
virtual void apply_central_impulse(const Vector2 &p_impulse) = 0;
virtual void apply_torque_impulse(real_t p_torque) = 0;
virtual void apply_impulse(const Vector2 &p_impulse, const Vector2 &p_position = Vector2()) = 0;
+ virtual void apply_central_force(const Vector2 &p_force) = 0;
+ virtual void apply_force(const Vector2 &p_force, const Vector2 &p_position = Vector2()) = 0;
+ virtual void apply_torque(real_t p_torque) = 0;
+
+ virtual void add_constant_central_force(const Vector2 &p_force) = 0;
+ virtual void add_constant_force(const Vector2 &p_force, const Vector2 &p_position = Vector2()) = 0;
+ virtual void add_constant_torque(real_t p_torque) = 0;
+
+ virtual void set_constant_force(const Vector2 &p_force) = 0;
+ virtual Vector2 get_constant_force() const = 0;
+
+ virtual void set_constant_torque(real_t p_torque) = 0;
+ virtual real_t get_constant_torque() const = 0;
+
virtual void set_sleep_state(bool p_enable) = 0;
virtual bool is_sleeping() const = 0;
@@ -242,11 +253,13 @@ public:
enum SpaceParameter {
SPACE_PARAM_CONTACT_RECYCLE_RADIUS,
SPACE_PARAM_CONTACT_MAX_SEPARATION,
- SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION,
+ SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION,
+ SPACE_PARAM_CONTACT_DEFAULT_BIAS,
SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD,
SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD,
SPACE_PARAM_BODY_TIME_TO_SLEEP,
SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS,
+ SPACE_PARAM_SOLVER_ITERATIONS,
};
virtual void space_set_param(RID p_space, SpaceParameter p_param, real_t p_value) = 0;
@@ -417,20 +430,24 @@ public:
virtual void body_set_state(RID p_body, BodyState p_state, const Variant &p_variant) = 0;
virtual Variant body_get_state(RID p_body, BodyState p_state) const = 0;
- //do something about it
- virtual void body_set_applied_force(RID p_body, const Vector2 &p_force) = 0;
- virtual Vector2 body_get_applied_force(RID p_body) const = 0;
-
- virtual void body_set_applied_torque(RID p_body, real_t p_torque) = 0;
- virtual real_t body_get_applied_torque(RID p_body) const = 0;
-
- virtual void body_add_central_force(RID p_body, const Vector2 &p_force) = 0;
- virtual void body_add_force(RID p_body, const Vector2 &p_force, const Vector2 &p_position = Vector2()) = 0;
- virtual void body_add_torque(RID p_body, real_t p_torque) = 0;
-
virtual void body_apply_central_impulse(RID p_body, const Vector2 &p_impulse) = 0;
virtual void body_apply_torque_impulse(RID p_body, real_t p_torque) = 0;
virtual void body_apply_impulse(RID p_body, const Vector2 &p_impulse, const Vector2 &p_position = Vector2()) = 0;
+
+ virtual void body_apply_central_force(RID p_body, const Vector2 &p_force) = 0;
+ virtual void body_apply_force(RID p_body, const Vector2 &p_force, const Vector2 &p_position = Vector2()) = 0;
+ virtual void body_apply_torque(RID p_body, real_t p_torque) = 0;
+
+ virtual void body_add_constant_central_force(RID p_body, const Vector2 &p_force) = 0;
+ virtual void body_add_constant_force(RID p_body, const Vector2 &p_force, const Vector2 &p_position = Vector2()) = 0;
+ virtual void body_add_constant_torque(RID p_body, real_t p_torque) = 0;
+
+ virtual void body_set_constant_force(RID p_body, const Vector2 &p_force) = 0;
+ virtual Vector2 body_get_constant_force(RID p_body) const = 0;
+
+ virtual void body_set_constant_torque(RID p_body, real_t p_torque) = 0;
+ virtual real_t body_get_constant_torque(RID p_body) const = 0;
+
virtual void body_set_axis_velocity(RID p_body, const Vector2 &p_axis_velocity) = 0;
//fix
@@ -566,8 +583,6 @@ public:
virtual bool is_flushing_queries() const = 0;
- virtual void set_collision_iterations(int p_iterations) = 0;
-
enum ProcessInfo {
INFO_ACTIVE_OBJECTS,
INFO_COLLISION_PAIRS,
@@ -758,10 +773,9 @@ class PhysicsServer2DManager {
name(p_ci.name),
create_callback(p_ci.create_callback) {}
- ClassInfo &operator=(const ClassInfo &p_ci) {
+ void operator=(const ClassInfo &p_ci) {
name = p_ci.name;
create_callback = p_ci.create_callback;
- return *this;
}
};