diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/SCsub | 2 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 110 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.h | 7 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.cpp | 18 | ||||
-rw-r--r-- | scene/3d/audio_stream_player_3d.h | 4 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 4 | ||||
-rw-r--r-- | scene/3d/camera.h | 10 | ||||
-rw-r--r-- | scene/3d/collision_object.cpp | 2 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 4 | ||||
-rw-r--r-- | scene/3d/immediate_geometry.h | 2 | ||||
-rw-r--r-- | scene/3d/interpolated_camera.cpp | 2 | ||||
-rw-r--r-- | scene/3d/light.cpp | 6 | ||||
-rw-r--r-- | scene/3d/navigation.cpp | 4 | ||||
-rw-r--r-- | scene/3d/physics_body.cpp | 2 | ||||
-rw-r--r-- | scene/3d/ray_cast.cpp | 10 | ||||
-rw-r--r-- | scene/3d/spatial_velocity_tracker.cpp | 28 | ||||
-rw-r--r-- | scene/3d/spatial_velocity_tracker.h | 6 | ||||
-rw-r--r-- | scene/3d/vehicle_body.cpp | 7 | ||||
-rw-r--r-- | scene/3d/vehicle_body.h | 2 |
19 files changed, 179 insertions, 51 deletions
diff --git a/scene/3d/SCsub b/scene/3d/SCsub index 90e78ba8d3..72739b527e 100644 --- a/scene/3d/SCsub +++ b/scene/3d/SCsub @@ -3,7 +3,7 @@ Import('env') -if (env["disable_3d"] == "yes"): +if env['disable_3d']: env.scene_sources.append("3d/spatial.cpp") env.scene_sources.append("3d/skeleton.cpp") diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 147d3bf115..c6b6c02129 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -67,6 +67,105 @@ String ARVRCamera::get_configuration_warning() const { return String(); }; +Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector3()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3()); + + if (!is_inside_tree()) { + ERR_EXPLAIN("Camera is not inside scene."); + ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); + }; + + Size2 viewport_size = get_viewport()->get_camera_rect_size(); + Vector2 cpos = get_viewport()->get_camera_coords(p_pos); + Vector3 ray; + + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + float screen_w, screen_h; + cm.get_viewport_size(screen_w, screen_h); + ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_w, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_h, -get_znear()).normalized(); + + return ray; +}; + +Point2 ARVRCamera::unproject_position(const Vector3 &p_pos) const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector2()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector2()); + + if (!is_inside_tree()) { + ERR_EXPLAIN("Camera is not inside scene."); + ERR_FAIL_COND_V(!is_inside_tree(), Vector2()); + }; + + Size2 viewport_size = get_viewport()->get_visible_rect().size; + + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + + Plane p(get_camera_transform().xform_inv(p_pos), 1.0); + + p = cm.xform4(p); + p.normal /= p.d; + + Point2 res; + res.x = (p.normal.x * 0.5 + 0.5) * viewport_size.x; + res.y = (-p.normal.y * 0.5 + 0.5) * viewport_size.y; + + return res; +}; + +Vector3 ARVRCamera::project_position(const Point2 &p_point) const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector3()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector3()); + + if (!is_inside_tree()) { + ERR_EXPLAIN("Camera is not inside scene."); + ERR_FAIL_COND_V(!is_inside_tree(), Vector3()); + }; + + Size2 viewport_size = get_viewport()->get_visible_rect().size; + + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + + Size2 vp_size; + cm.get_viewport_size(vp_size.x, vp_size.y); + + Vector2 point; + point.x = (p_point.x / viewport_size.x) * 2.0 - 1.0; + point.y = (1.0 - (p_point.y / viewport_size.y)) * 2.0 - 1.0; + point *= vp_size; + + Vector3 p(point.x, point.y, -get_znear()); + + return get_camera_transform().xform(p); +}; + +Vector<Plane> ARVRCamera::get_frustum() const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, Vector<Plane>()); + + Ref<ARVRInterface> arvr_interface = arvr_server->get_primary_interface(); + ERR_FAIL_COND_V(arvr_interface.is_null(), Vector<Plane>()); + + ERR_FAIL_COND_V(!is_inside_world(), Vector<Plane>()); + + Size2 viewport_size = get_viewport()->get_visible_rect().size; + CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar()); + return cm.get_projection_planes(get_camera_transform()); +}; + ARVRCamera::ARVRCamera(){ // nothing to do here yet for now.. }; @@ -297,6 +396,8 @@ void ARVRAnchor::_bind_methods() { ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRAnchor::get_is_active); ClassDB::bind_method(D_METHOD("get_size"), &ARVRAnchor::get_size); + + ClassDB::bind_method(D_METHOD("get_plane"), &ARVRAnchor::get_plane); }; void ARVRAnchor::set_anchor_id(int p_anchor_id) { @@ -346,6 +447,15 @@ String ARVRAnchor::get_configuration_warning() const { return String(); }; +Plane ARVRAnchor::get_plane() const { + Vector3 location = get_translation(); + Basis orientation = get_transform().basis; + + Plane plane(location, orientation.get_axis(1).normalized()); + + return plane; +}; + ARVRAnchor::ARVRAnchor() { anchor_id = 0; is_active = true; diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index 5269ec0248..e0ccfab58b 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -52,6 +52,11 @@ protected: public: String get_configuration_warning() const; + virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const; + virtual Point2 unproject_position(const Vector3 &p_pos) const; + virtual Vector3 project_position(const Point2 &p_point) const; + virtual Vector<Plane> get_frustum() const; + ARVRCamera(); ~ARVRCamera(); }; @@ -118,6 +123,8 @@ public: bool get_is_active() const; Vector3 get_size() const; + Plane get_plane() const; + String get_configuration_warning() const; ARVRAnchor(); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index c8c478ae18..3c92814c87 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -214,7 +214,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { } } - if (p_what == NOTIFICATION_INTERNAL_FIXED_PROCESS) { + if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) { //update anything related to position first, if possible of course @@ -512,7 +512,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { //stop playing if no longer active if (!active) { - set_fixed_process_internal(false); + set_physics_process_internal(false); //do not update, this makes it easier to animate (will shut off otherise) //_change_notify("playing"); //update property in editor emit_signal("finished"); @@ -582,7 +582,7 @@ void AudioStreamPlayer3D::play(float p_from_pos) { if (stream_playback.is_valid()) { setplay = p_from_pos; output_ready = false; - set_fixed_process_internal(true); + set_physics_process_internal(true); } } @@ -597,7 +597,7 @@ void AudioStreamPlayer3D::stop() { if (stream_playback.is_valid()) { active = false; - set_fixed_process_internal(false); + set_physics_process_internal(false); setplay = -1; } } @@ -611,10 +611,10 @@ bool AudioStreamPlayer3D::is_playing() const { return false; } -float AudioStreamPlayer3D::get_position() { +float AudioStreamPlayer3D::get_playback_position() { if (stream_playback.is_valid()) { - return stream_playback->get_position(); + return stream_playback->get_playback_position(); } return 0; @@ -776,7 +776,7 @@ void AudioStreamPlayer3D::set_doppler_tracking(DopplerTracking p_tracking) { if (doppler_tracking != DOPPLER_TRACKING_DISABLED) { set_notify_transform(true); - velocity_tracker->set_track_fixed_step(doppler_tracking == DOPPLER_TRACKING_FIXED_STEP); + velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP); velocity_tracker->reset(get_global_transform().origin); } else { set_notify_transform(false); @@ -807,7 +807,7 @@ void AudioStreamPlayer3D::_bind_methods() { ClassDB::bind_method(D_METHOD("stop"), &AudioStreamPlayer3D::stop); ClassDB::bind_method(D_METHOD("is_playing"), &AudioStreamPlayer3D::is_playing); - ClassDB::bind_method(D_METHOD("get_position"), &AudioStreamPlayer3D::get_position); + ClassDB::bind_method(D_METHOD("get_playback_position"), &AudioStreamPlayer3D::get_playback_position); ClassDB::bind_method(D_METHOD("set_bus", "bus"), &AudioStreamPlayer3D::set_bus); ClassDB::bind_method(D_METHOD("get_bus"), &AudioStreamPlayer3D::get_bus); @@ -880,7 +880,7 @@ void AudioStreamPlayer3D::_bind_methods() { BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED); BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP); - BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP); ADD_SIGNAL(MethodInfo("finished")); } diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h index a6ce123790..5982d7a3ac 100644 --- a/scene/3d/audio_stream_player_3d.h +++ b/scene/3d/audio_stream_player_3d.h @@ -26,7 +26,7 @@ public: enum DopplerTracking { DOPPLER_TRACKING_DISABLED, DOPPLER_TRACKING_IDLE_STEP, - DOPPLER_TRACKING_FIXED_STEP + DOPPLER_TRACKING_PHYSICS_STEP }; private: @@ -127,7 +127,7 @@ public: void seek(float p_seconds); void stop(); bool is_playing() const; - float get_position(); + float get_playback_position(); void set_bus(const StringName &p_bus); StringName get_bus() const; diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 02a7845e0b..7baf9a9deb 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -507,7 +507,7 @@ void Camera::set_doppler_tracking(DopplerTracking p_tracking) { doppler_tracking = p_tracking; if (p_tracking != DOPPLER_TRACKING_DISABLED) { - velocity_tracker->set_track_fixed_step(doppler_tracking == DOPPLER_TRACKING_FIXED_STEP); + velocity_tracker->set_track_physics_step(doppler_tracking == DOPPLER_TRACKING_PHYSICS_STEP); velocity_tracker->reset(get_global_transform().origin); } } @@ -557,7 +557,7 @@ void Camera::_bind_methods() { BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED) BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP) - BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP) } float Camera::get_fov() const { diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 243a7b9b39..73c6844c1a 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -56,7 +56,7 @@ public: enum DopplerTracking { DOPPLER_TRACKING_DISABLED, DOPPLER_TRACKING_IDLE_STEP, - DOPPLER_TRACKING_FIXED_STEP + DOPPLER_TRACKING_PHYSICS_STEP }; private: @@ -127,16 +127,16 @@ public: virtual Transform get_camera_transform() const; Vector3 project_ray_normal(const Point2 &p_pos) const; - Vector3 project_ray_origin(const Point2 &p_pos) const; + virtual Vector3 project_ray_origin(const Point2 &p_pos) const; Vector3 project_local_ray_normal(const Point2 &p_pos) const; - Point2 unproject_position(const Vector3 &p_pos) const; + virtual Point2 unproject_position(const Vector3 &p_pos) const; bool is_position_behind(const Vector3 &p_pos) const; - Vector3 project_position(const Point2 &p_point) const; + virtual Vector3 project_position(const Point2 &p_point) const; void set_cull_mask(uint32_t p_layers); uint32_t get_cull_mask() const; - Vector<Plane> get_frustum() const; + virtual Vector<Plane> get_frustum() const; void set_environment(const Ref<Environment> &p_environment); Ref<Environment> get_environment() const; diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 1c0633fba7..7b4770e435 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -161,7 +161,7 @@ uint32_t CollisionObject::create_shape_owner(Object *p_owner) { uint32_t id; if (shapes.size() == 0) { - id = 1; + id = 0; } else { id = shapes.back()->key() + 1; } diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 66364d40f9..9d55a82824 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1486,8 +1486,8 @@ GIProbe::GIProbe() { subdiv = SUBDIV_128; dynamic_range = 4; energy = 1.0; - bias = 0.0; - normal_bias = 0.8; + bias = 1.5; + normal_bias = 0.0; propagation = 1.0; extents = Vector3(10, 10, 10); color_scan_cell_width = 4; diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 6db825bf54..93ef726c6d 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -38,7 +38,7 @@ class ImmediateGeometry : public GeometryInstance { GDCLASS(ImmediateGeometry, GeometryInstance); RID im; - //a list of texures drawn need to be kept, to avoid references + //a list of textures drawn need to be kept, to avoid references // in VisualServer from becoming invalid if the texture is no longer used List<Ref<Texture> > cached_textures; bool empty; diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 0f281b694d..3ff8317732 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -37,7 +37,7 @@ void InterpolatedCamera::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { if (Engine::get_singleton()->is_editor_hint() && enabled) - set_fixed_process(false); + set_physics_process(false); } break; case NOTIFICATION_PROCESS: { diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 7402e664d9..b7cd9bd2dc 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -369,6 +369,12 @@ DirectionalLight::DirectionalLight() set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE); blend_splits = false; + +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) + // Create light with a default natural "sun" orientation in editor, instead of looking horizontally on X + set_rotation_in_degrees(Vector3(-50, 25, 30)); +#endif } void OmniLight::set_shadow_mode(ShadowMode p_mode) { diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index d8c7a78648..b226cca02b 100644 --- a/scene/3d/navigation.cpp +++ b/scene/3d/navigation.cpp @@ -35,8 +35,6 @@ void Navigation::_navmesh_link(int p_id) { NavMesh &nm = navmesh_map[p_id]; ERR_FAIL_COND(nm.linked); - print_line("LINK"); - PoolVector<Vector3> vertices = nm.navmesh->get_vertices(); int len = vertices.size(); if (len == 0) @@ -144,8 +142,6 @@ void Navigation::_navmesh_unlink(int p_id) { NavMesh &nm = navmesh_map[p_id]; ERR_FAIL_COND(!nm.linked); - print_line("UNLINK"); - for (List<Polygon>::Element *E = nm.polygons.front(); E; E = E->next()) { Polygon &p = E->get(); diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 005ea1f8d1..d7fdf94d40 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -960,7 +960,7 @@ bool KinematicBody::move_and_collide(const Vector3 &p_motion, Collision &r_colli Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Vector3 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_slides, float p_floor_max_angle) { - Vector3 motion = (floor_velocity + p_linear_velocity) * get_fixed_process_delta_time(); + Vector3 motion = (floor_velocity + p_linear_velocity) * get_physics_process_delta_time(); Vector3 lv = p_linear_velocity; on_floor = false; diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 72b7706b77..df6764ee1a 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -97,7 +97,7 @@ void RayCast::set_enabled(bool p_enabled) { enabled = p_enabled; if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) - set_fixed_process(p_enabled); + set_physics_process(p_enabled); if (!p_enabled) collided = false; @@ -121,25 +121,25 @@ void RayCast::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { if (enabled && !Engine::get_singleton()->is_editor_hint()) { - set_fixed_process(true); + set_physics_process(true); if (get_tree()->is_debugging_collisions_hint()) _update_debug_shape(); } else - set_fixed_process(false); + set_physics_process(false); } break; case NOTIFICATION_EXIT_TREE: { if (enabled) { - set_fixed_process(false); + set_physics_process(false); } if (debug_shape) _clear_debug_shape(); } break; - case NOTIFICATION_FIXED_PROCESS: { + case NOTIFICATION_PHYSICS_PROCESS: { if (!enabled) break; diff --git a/scene/3d/spatial_velocity_tracker.cpp b/scene/3d/spatial_velocity_tracker.cpp index dc822d0446..1c7423e645 100644 --- a/scene/3d/spatial_velocity_tracker.cpp +++ b/scene/3d/spatial_velocity_tracker.cpp @@ -1,21 +1,21 @@ #include "spatial_velocity_tracker.h" #include "engine.h" -void SpatialVelocityTracker::set_track_fixed_step(bool p_track_fixed_step) { +void SpatialVelocityTracker::set_track_physics_step(bool p_track_physics_step) { - fixed_step = p_track_fixed_step; + physics_step = p_track_physics_step; } -bool SpatialVelocityTracker::is_tracking_fixed_step() const { +bool SpatialVelocityTracker::is_tracking_physics_step() const { - return fixed_step; + return physics_step; } void SpatialVelocityTracker::update_position(const Vector3 &p_position) { PositionHistory ph; ph.position = p_position; - if (fixed_step) { - ph.frame = Engine::get_singleton()->get_fixed_frames(); + if (physics_step) { + ph.frame = Engine::get_singleton()->get_physics_frames(); } else { ph.frame = Engine::get_singleton()->get_idle_frame_ticks(); } @@ -40,8 +40,8 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const { float base_time = 0.0; if (position_history_len) { - if (fixed_step) { - uint64_t base = Engine::get_singleton()->get_fixed_frames(); + if (physics_step) { + uint64_t base = Engine::get_singleton()->get_physics_frames(); base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second(); } else { uint64_t base = Engine::get_singleton()->get_idle_frame_ticks(); @@ -54,7 +54,7 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const { uint64_t diff = position_history[i].frame - position_history[i + 1].frame; Vector3 distance = position_history[i].position - position_history[i + 1].position; - if (fixed_step) { + if (physics_step) { delta = float(diff) / Engine::get_singleton()->get_iterations_per_second(); } else { delta = double(diff) / 1000000.0; @@ -78,8 +78,8 @@ void SpatialVelocityTracker::reset(const Vector3 &p_new_pos) { PositionHistory ph; ph.position = p_new_pos; - if (fixed_step) { - ph.frame = Engine::get_singleton()->get_fixed_frames(); + if (physics_step) { + ph.frame = Engine::get_singleton()->get_physics_frames(); } else { ph.frame = Engine::get_singleton()->get_idle_frame_ticks(); } @@ -90,8 +90,8 @@ void SpatialVelocityTracker::reset(const Vector3 &p_new_pos) { void SpatialVelocityTracker::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_track_fixed_step", "enable"), &SpatialVelocityTracker::set_track_fixed_step); - ClassDB::bind_method(D_METHOD("is_tracking_fixed_step"), &SpatialVelocityTracker::is_tracking_fixed_step); + ClassDB::bind_method(D_METHOD("set_track_physics_step", "enable"), &SpatialVelocityTracker::set_track_physics_step); + ClassDB::bind_method(D_METHOD("is_tracking_physics_step"), &SpatialVelocityTracker::is_tracking_physics_step); ClassDB::bind_method(D_METHOD("update_position", "position"), &SpatialVelocityTracker::update_position); ClassDB::bind_method(D_METHOD("get_tracked_linear_velocity"), &SpatialVelocityTracker::get_tracked_linear_velocity); ClassDB::bind_method(D_METHOD("reset", "position"), &SpatialVelocityTracker::reset); @@ -100,5 +100,5 @@ void SpatialVelocityTracker::_bind_methods() { SpatialVelocityTracker::SpatialVelocityTracker() { position_history.resize(4); // should be configurable position_history_len = 0; - fixed_step = false; + physics_step = false; } diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h index b8237613a7..c4371ff1f7 100644 --- a/scene/3d/spatial_velocity_tracker.h +++ b/scene/3d/spatial_velocity_tracker.h @@ -11,7 +11,7 @@ class SpatialVelocityTracker : public Reference { Vector3 position; }; - bool fixed_step; + bool physics_step; Vector<PositionHistory> position_history; int position_history_len; @@ -20,8 +20,8 @@ protected: public: void reset(const Vector3 &p_new_pos); - void set_track_fixed_step(bool p_track_fixed_step); - bool is_tracking_fixed_step() const; + void set_track_physics_step(bool p_track_physics_step); + bool is_tracking_physics_step() const; void update_position(const Vector3 &p_position); Vector3 get_tracked_linear_velocity() const; diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 3518113130..a072572142 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -267,6 +267,8 @@ void VehicleWheel::_bind_methods() { ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel::set_roll_influence); ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel::get_roll_influence); + ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel::get_skidinfo); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_traction"), "set_use_as_traction", "is_used_as_traction"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_steering"), "set_use_as_steering", "is_used_as_steering"); ADD_GROUP("Wheel", "wheel_"); @@ -303,6 +305,11 @@ bool VehicleWheel::is_used_as_steering() const { return steers; } +float VehicleWheel::get_skidinfo() const { + + return m_skidInfo; +} + VehicleWheel::VehicleWheel() { steers = false; diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index eb661adb90..c642eb61b8 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -131,6 +131,8 @@ public: void set_roll_influence(float p_value); float get_roll_influence() const; + float get_skidinfo() const; + String get_configuration_warning() const; VehicleWheel(); |