summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/camera_3d.cpp1
-rw-r--r--scene/3d/camera_3d.h1
-rw-r--r--scene/3d/light_3d.h8
-rw-r--r--scene/3d/physics_body_3d.cpp20
-rw-r--r--scene/3d/physics_body_3d.h6
-rw-r--r--scene/3d/ray_cast_3d.cpp3
-rw-r--r--scene/3d/vehicle_body_3d.cpp9
-rw-r--r--scene/3d/world_environment.cpp1
-rw-r--r--scene/3d/world_environment.h2
9 files changed, 28 insertions, 23 deletions
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 689afa5608..ecbaca7bd1 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -35,6 +35,7 @@
#include "core/math/camera_matrix.h"
#include "scene/resources/material.h"
#include "scene/resources/surface_tool.h"
+
void Camera3D::_update_audio_listener_state() {
}
diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h
index 138b1b8a7a..5c9431e08a 100644
--- a/scene/3d/camera_3d.h
+++ b/scene/3d/camera_3d.h
@@ -34,6 +34,7 @@
#include "scene/3d/node_3d.h"
#include "scene/3d/velocity_tracker_3d.h"
#include "scene/main/window.h"
+#include "scene/resources/camera_effects.h"
#include "scene/resources/environment.h"
class Camera3D : public Node3D {
diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h
index 09fc81b216..71df1b5ded 100644
--- a/scene/3d/light_3d.h
+++ b/scene/3d/light_3d.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef LIGHT_H
-#define LIGHT_H
+#ifndef LIGHT_3D_H
+#define LIGHT_3D_H
#include "scene/3d/visual_instance_3d.h"
#include "scene/resources/texture.h"
@@ -145,7 +145,7 @@ public:
enum ShadowMode {
SHADOW_ORTHOGONAL,
SHADOW_PARALLEL_2_SPLITS,
- SHADOW_PARALLEL_4_SPLITS
+ SHADOW_PARALLEL_4_SPLITS,
};
enum ShadowDepthRange {
@@ -217,4 +217,4 @@ public:
Light3D(RenderingServer::LIGHT_SPOT) {}
};
-#endif
+#endif // LIGHT_3D_H
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 6320af21eb..fda072e233 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -638,8 +638,9 @@ void RigidBody3D::add_central_force(const Vector3 &p_force) {
PhysicsServer3D::get_singleton()->body_add_central_force(get_rid(), p_force);
}
-void RigidBody3D::add_force(const Vector3 &p_force, const Vector3 &p_pos) {
- PhysicsServer3D::get_singleton()->body_add_force(get_rid(), p_force, p_pos);
+void RigidBody3D::add_force(const Vector3 &p_force, const Vector3 &p_position) {
+ PhysicsServer3D *singleton = PhysicsServer3D::get_singleton();
+ singleton->body_add_force(get_rid(), p_force, p_position);
}
void RigidBody3D::add_torque(const Vector3 &p_torque) {
@@ -650,8 +651,9 @@ void RigidBody3D::apply_central_impulse(const Vector3 &p_impulse) {
PhysicsServer3D::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
}
-void RigidBody3D::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
- PhysicsServer3D::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
+void RigidBody3D::apply_impulse(const Vector3 &p_impulse, const Vector3 &p_position) {
+ PhysicsServer3D *singleton = PhysicsServer3D::get_singleton();
+ singleton->body_apply_impulse(get_rid(), p_impulse, p_position);
}
void RigidBody3D::apply_torque_impulse(const Vector3 &p_impulse) {
@@ -782,11 +784,11 @@ void RigidBody3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_axis_velocity", "axis_velocity"), &RigidBody3D::set_axis_velocity);
ClassDB::bind_method(D_METHOD("add_central_force", "force"), &RigidBody3D::add_central_force);
- ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &RigidBody3D::add_force);
+ ClassDB::bind_method(D_METHOD("add_force", "force", "position"), &RigidBody3D::add_force, Vector3());
ClassDB::bind_method(D_METHOD("add_torque", "torque"), &RigidBody3D::add_torque);
ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &RigidBody3D::apply_central_impulse);
- ClassDB::bind_method(D_METHOD("apply_impulse", "position", "impulse"), &RigidBody3D::apply_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "impulse", "position"), &RigidBody3D::apply_impulse, Vector3());
ClassDB::bind_method(D_METHOD("apply_torque_impulse", "impulse"), &RigidBody3D::apply_torque_impulse);
ClassDB::bind_method(D_METHOD("set_sleeping", "sleeping"), &RigidBody3D::set_sleeping);
@@ -1372,8 +1374,8 @@ void PhysicalBone3D::apply_central_impulse(const Vector3 &p_impulse) {
PhysicsServer3D::get_singleton()->body_apply_central_impulse(get_rid(), p_impulse);
}
-void PhysicalBone3D::apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse) {
- PhysicsServer3D::get_singleton()->body_apply_impulse(get_rid(), p_pos, p_impulse);
+void PhysicalBone3D::apply_impulse(const Vector3 &p_impulse, const Vector3 &p_position) {
+ PhysicsServer3D::get_singleton()->body_apply_impulse(get_rid(), p_impulse, p_position);
}
void PhysicalBone3D::reset_physics_simulation_state() {
@@ -2099,7 +2101,7 @@ void PhysicalBone3D::_direct_state_changed(Object *p_state) {
void PhysicalBone3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("apply_central_impulse", "impulse"), &PhysicalBone3D::apply_central_impulse);
- ClassDB::bind_method(D_METHOD("apply_impulse", "position", "impulse"), &PhysicalBone3D::apply_impulse);
+ ClassDB::bind_method(D_METHOD("apply_impulse", "impulse", "position"), &PhysicalBone3D::apply_impulse, Vector3());
ClassDB::bind_method(D_METHOD("_direct_state_changed"), &PhysicalBone3D::_direct_state_changed);
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h
index 4c58c73942..e846b7a7f8 100644
--- a/scene/3d/physics_body_3d.h
+++ b/scene/3d/physics_body_3d.h
@@ -234,11 +234,11 @@ public:
Array get_colliding_bodies() const;
void add_central_force(const Vector3 &p_force);
- void add_force(const Vector3 &p_force, const Vector3 &p_pos);
+ void add_force(const Vector3 &p_force, const Vector3 &p_position = Vector3());
void add_torque(const Vector3 &p_torque);
void apply_central_impulse(const Vector3 &p_impulse);
- void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
+ void apply_impulse(const Vector3 &p_impulse, const Vector3 &p_position = Vector3());
void apply_torque_impulse(const Vector3 &p_impulse);
virtual String get_configuration_warning() const;
@@ -597,7 +597,7 @@ public:
bool get_axis_lock(PhysicsServer3D::BodyAxis p_axis) const;
void apply_central_impulse(const Vector3 &p_impulse);
- void apply_impulse(const Vector3 &p_pos, const Vector3 &p_impulse);
+ void apply_impulse(const Vector3 &p_impulse, const Vector3 &p_position = Vector3());
void reset_physics_simulation_state();
void reset_to_rest_position();
diff --git a/scene/3d/ray_cast_3d.cpp b/scene/3d/ray_cast_3d.cpp
index 68f4b3132c..2a922e3cda 100644
--- a/scene/3d/ray_cast_3d.cpp
+++ b/scene/3d/ray_cast_3d.cpp
@@ -383,8 +383,7 @@ void RayCast3D::_clear_debug_shape() {
}
RayCast3D::RayCast3D() {
- enabled = false;
-
+ enabled = true;
collided = false;
against_shape = 0;
collision_mask = 1;
diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp
index 9c6b940b00..4c71ab470b 100644
--- a/scene/3d/vehicle_body_3d.cpp
+++ b/scene/3d/vehicle_body_3d.cpp
@@ -794,7 +794,7 @@ void VehicleBody3D::_update_friction(PhysicsDirectBodyState3D *s) {
s->get_transform().origin;
if (m_forwardImpulse[wheel] != real_t(0.)) {
- s->apply_impulse(rel_pos, m_forwardWS[wheel] * (m_forwardImpulse[wheel]));
+ s->apply_impulse(m_forwardWS[wheel] * (m_forwardImpulse[wheel]), rel_pos);
}
if (m_sideImpulse[wheel] != real_t(0.)) {
PhysicsBody3D *groundObject = wheelInfo.m_raycastInfo.m_groundObject;
@@ -812,7 +812,7 @@ void VehicleBody3D::_update_friction(PhysicsDirectBodyState3D *s) {
#else
rel_pos[1] *= wheelInfo.m_rollInfluence; //?
#endif
- s->apply_impulse(rel_pos, sideImp);
+ s->apply_impulse(sideImp, rel_pos);
//apply friction impulse on the ground
//todo
@@ -850,10 +850,9 @@ void VehicleBody3D::_direct_state_changed(Object *p_state) {
suspensionForce = wheel.m_maxSuspensionForce;
}
Vector3 impulse = wheel.m_raycastInfo.m_contactNormalWS * suspensionForce * step;
- Vector3 relpos = wheel.m_raycastInfo.m_contactPointWS - state->get_transform().origin;
+ Vector3 relative_position = wheel.m_raycastInfo.m_contactPointWS - state->get_transform().origin;
- state->apply_impulse(relpos, impulse);
- //getRigidBody()->applyImpulse(impulse, relpos);
+ state->apply_impulse(impulse, relative_position);
}
_update_friction(state);
diff --git a/scene/3d/world_environment.cpp b/scene/3d/world_environment.cpp
index 24071f31f3..5e73e460ed 100644
--- a/scene/3d/world_environment.cpp
+++ b/scene/3d/world_environment.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "world_environment.h"
+
#include "scene/main/window.h"
void WorldEnvironment::_notification(int p_what) {
diff --git a/scene/3d/world_environment.h b/scene/3d/world_environment.h
index ddb2af7bd3..4a0dbd35a3 100644
--- a/scene/3d/world_environment.h
+++ b/scene/3d/world_environment.h
@@ -32,6 +32,8 @@
#define SCENARIO_FX_H
#include "scene/3d/node_3d.h"
+#include "scene/resources/camera_effects.h"
+#include "scene/resources/environment.h"
class WorldEnvironment : public Node {
GDCLASS(WorldEnvironment, Node);