summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp6
-rw-r--r--doc/classes/@GDScript.xml6
-rw-r--r--doc/classes/Color.xml3
-rw-r--r--drivers/unix/os_unix.cpp24
-rw-r--r--editor/editor_data.cpp16
-rw-r--r--editor/editor_data.h4
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/import/resource_importer_wav.cpp12
-rw-r--r--editor/scene_tree_dock.cpp5
-rw-r--r--editor/script_editor_debugger.cpp5
-rw-r--r--platform/osx/export/export.cpp22
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm25
-rw-r--r--scene/3d/physics_body.h5
-rw-r--r--scene/3d/vehicle_body.cpp75
-rw-r--r--scene/3d/vehicle_body.h19
16 files changed, 127 insertions, 104 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 2921626f3a..c7b08b8242 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2466,7 +2466,13 @@ Array _ClassDB::get_method_list(StringName p_class, bool p_no_inheritance) const
Array ret;
for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
+#ifdef DEBUG_METHODS_ENABLED
ret.push_back(E->get().operator Dictionary());
+#else
+ Dictionary dict;
+ dict["name"] = E->get().name;
+ ret.push_back(dict);
+#endif
}
return ret;
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index cd05c83347..c98a80ca8c 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -41,10 +41,12 @@
<argument index="1" name="alpha" type="float">
</argument>
<description>
- Returns color [code]name[/code] with [code]alpha[/code] ranging from 0 to 1. Note: [code]name[/code] is defined in color_names.inc.
+ Returns a color according to the standardised [code]name[/code] with [code]alpha[/code] ranging from 0 to 1.
[codeblock]
- red = ColorN('red')
+ red = ColorN("red", 1)
[/codeblock]
+ Supported color names:
+ "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflower", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "webgray", "green", "webgreen", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrod", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "webmaroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navyblue", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "webpurple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen".
</description>
</method>
<method name="abs">
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml
index 6fa7ed0a86..ef555537a1 100644
--- a/doc/classes/Color.xml
+++ b/doc/classes/Color.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate(color)) may accept values &gt; 1.
+ You can also create a color from standardised color names with [method @GDScript.ColorN].
</description>
<tutorials>
</tutorials>
@@ -63,7 +64,7 @@
<argument index="0" name="from" type="String">
</argument>
<description>
- Constructs a color from an HTML hexadecimal color string in ARGB or RGB format.
+ Constructs a color from an HTML hexadecimal color string in ARGB or RGB format. See also [method @GDScript.ColorN].
The following string formats are supported:
[code]"#ff00ff00"[/code] - ARGB format with '#'
[code]"ff00ff00"[/code] - ARGB format
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 0f30e3afdb..5f45f06c79 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -53,6 +53,7 @@
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/param.h>
+#include <sys/sysctl.h>
#endif
#include "project_settings.h"
#include <assert.h>
@@ -298,17 +299,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
args.push_back((char *)cs[i].get_data()); // shitty C cast
args.push_back(0);
-#ifdef __FreeBSD__
- if (p_path.find("/") != -1) {
- // exec name contains path so use it
- execv(p_path.utf8().get_data(), &args[0]);
- } else {
- // use program name and search through PATH to find it
- execvp(getprogname(), &args[0]);
- }
-#else
execvp(p_path.utf8().get_data(), &args[0]);
-#endif
// still alive? something failed..
fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data());
abort();
@@ -462,12 +453,23 @@ String OS_Unix::get_executable_path() const {
return OS::get_executable_path();
}
return b;
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+#elif defined(__OpenBSD__)
char resolved_path[MAXPATHLEN];
realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
return String(resolved_path);
+#elif defined(__FreeBSD__)
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+ char buf[MAXPATHLEN];
+ size_t len = sizeof(buf);
+ if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) {
+ WARN_PRINT("Couldn't get executable path from sysctl");
+ return OS::get_executable_path();
+ }
+ String b;
+ b.parse_utf8(buf);
+ return b;
#elif defined(__APPLE__)
char temp_path[1];
uint32_t buff_size = 1;
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 9e8521e0fe..374688f2db 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -38,7 +38,7 @@
#include "project_settings.h"
#include "scene/resources/packed_scene.h"
-void EditorHistory::_cleanup_history() {
+void EditorHistory::cleanup_history() {
for (int i = 0; i < history.size(); i++) {
@@ -48,8 +48,14 @@ void EditorHistory::_cleanup_history() {
if (!history[i].path[j].ref.is_null())
continue;
- if (ObjectDB::get_instance(history[i].path[j].object))
- continue; //has isntance, try next
+ Object *obj = ObjectDB::get_instance(history[i].path[j].object);
+ if (obj) {
+ Node *n = Object::cast_to<Node>(obj);
+ if (n && n->is_inside_tree())
+ continue;
+ if (!n) // Possibly still alive
+ continue;
+ }
if (j <= history[i].level) {
//before or equal level, complete fail
@@ -152,7 +158,7 @@ bool EditorHistory::is_at_end() const {
bool EditorHistory::next() {
- _cleanup_history();
+ cleanup_history();
if ((current + 1) < history.size())
current++;
@@ -164,7 +170,7 @@ bool EditorHistory::next() {
bool EditorHistory::previous() {
- _cleanup_history();
+ cleanup_history();
if (current > 0)
current--;
diff --git a/editor/editor_data.h b/editor/editor_data.h
index eacde04134..844145853d 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -70,11 +70,11 @@ class EditorHistory {
Variant value;
};
- void _cleanup_history();
-
void _add_object(ObjectID p_object, const String &p_property, int p_level_change);
public:
+ void cleanup_history();
+
bool is_at_beginning() const;
bool is_at_end() const;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f480883867..2b62faf218 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1398,7 +1398,7 @@ void EditorNode::_property_editor_forward() {
}
void EditorNode::_property_editor_back() {
- if (editor_history.previous())
+ if (editor_history.previous() || editor_history.get_path_size() == 1)
_edit_current();
}
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 12aa0bb33c..03155b3a48 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -268,9 +268,15 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
for (int i = 0; i < 10; i++)
file->get_32(); // i wish to know why should i do this... no doc!
- loop = file->get_32() ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD;
- loop_begin = file->get_32();
- loop_end = file->get_32();
+ // only read 0x00 (loop forward) and 0x01 (loop ping-pong) and skip anything else because
+ // it's not supported (loop backward), reserved for future uses or sampler specific
+ // from https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl (loop type values table)
+ int loop_type = file->get_32();
+ if (loop_type == 0x00 || loop_type == 0x01) {
+ loop = loop_type ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD;
+ loop_begin = file->get_32();
+ loop_end = file->get_32();
+ }
}
file->seek(file_pos + chunksize);
}
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 1f732992d5..d8d44a635a 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1285,6 +1285,11 @@ void SceneTreeDock::_delete_confirm() {
editor->get_viewport_control()->update();
editor->push_item(NULL);
+
+ // Fixes the EditorHistory from still offering deleted notes
+ EditorHistory *editor_history = EditorNode::get_singleton()->get_editor_history();
+ editor_history->cleanup_history();
+ EditorNode::get_singleton()->call("_prepare_history");
}
void SceneTreeDock::_selection_changed() {
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index e993c2fd46..cbf2687d73 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1053,6 +1053,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
break;
};
+ const uint64_t until = OS::get_singleton()->get_ticks_msec() + 20;
+
while (ppeer->get_available_packet_count() > 0) {
if (pending_in_queue) {
@@ -1117,6 +1119,9 @@ void ScriptEditorDebugger::_notification(int p_what) {
break;
}
}
+
+ if (OS::get_singleton()->get_ticks_msec() > until)
+ break;
}
} break;
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 23ca1e3fb9..c4efa1f0ff 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -359,6 +359,11 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
}
if (err == OK) {
+ print_line("Creating " + tmp_app_path_name + "/Contents/Frameworks");
+ err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Frameworks");
+ }
+
+ if (err == OK) {
print_line("Creating " + tmp_app_path_name + "/Contents/Resources");
err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources");
}
@@ -502,10 +507,23 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
if (use_dmg()) {
String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck";
- err = save_pack(p_preset, pack_path);
+ Vector<SharedObject> shared_objects;
+ Error err = save_pack(p_preset, pack_path, &shared_objects);
// see if we can code sign our new package
String identity = p_preset->get("codesign/identity");
+
+ if (err == OK) {
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ for (int i = 0; i < shared_objects.size(); i++) {
+ da->copy(shared_objects[i].path, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file());
+ if (err == OK && identity != "") {
+ err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file());
+ }
+ }
+ memdelete(da);
+ }
+
if (err == OK && identity != "") {
ep.step("Code signing bundle", 2);
@@ -582,7 +600,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
ERR_CONTINUE(file.empty());
zipOpenNewFileInZip(dst_pkg_zip,
- (pkg_name + ".app/Contents/MacOS/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(),
+ (pkg_name + ".app/Contents/Frameworks/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(),
NULL,
NULL,
0,
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 9423b6e1d6..3648d41604 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -139,6 +139,8 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false);
+
virtual void set_cursor_shape(CursorShape p_shape);
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 19f33c814f..939f75859c 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -39,6 +39,8 @@
#include "servers/visual/visual_server_raster.h"
#include "version_generated.gen.h"
+#include <mach-o/dyld.h>
+
#include <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#include <IOKit/IOCFPlugIn.h>
@@ -49,6 +51,7 @@
#include <os/log.h>
#endif
+#include <dlfcn.h>
#include <fcntl.h>
#include <libproc.h>
#include <stdio.h>
@@ -1262,6 +1265,28 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) {
[window release];
}
+Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+
+ String path = p_path;
+
+ if (!FileAccess::exists(path)) {
+ //this code exists so gdnative can load .dylib files from within the executable path
+ path = get_executable_path().get_base_dir().plus_file(p_path.get_file());
+ }
+
+ if (!FileAccess::exists(path)) {
+ //this code exists so gdnative can load .dylib files from a standard macOS location
+ path = get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(p_path.get_file());
+ }
+
+ p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
+ if (!p_library_handle) {
+ ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
+ ERR_FAIL_V(ERR_CANT_OPEN);
+ }
+ return OK;
+}
+
void OS_OSX::set_cursor_shape(CursorShape p_shape) {
if (cursor_shape == p_shape)
diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h
index 332eb3c740..c7556c0c5f 100644
--- a/scene/3d/physics_body.h
+++ b/scene/3d/physics_body.h
@@ -115,7 +115,7 @@ public:
MODE_KINEMATIC,
};
-private:
+protected:
bool can_sleep;
PhysicsDirectBodyState *state;
Mode mode;
@@ -178,9 +178,8 @@ private:
void _body_exit_tree(ObjectID p_id);
void _body_inout(int p_status, ObjectID p_instance, int p_body_shape, int p_local_shape);
- void _direct_state_changed(Object *p_state);
+ virtual void _direct_state_changed(Object *p_state);
-protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index bc968b0a5f..aeee51c4b2 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -375,7 +375,7 @@ void VehicleBody::_update_wheel(int p_idx, PhysicsDirectBodyState *s) {
Basis steeringMat(up, steering);
- Basis rotatingMat(right, -wheel.m_rotation);
+ Basis rotatingMat(right, wheel.m_rotation);
/*
if (p_idx==1)
@@ -816,26 +816,24 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) {
void VehicleBody::_direct_state_changed(Object *p_state) {
- PhysicsDirectBodyState *s = Object::cast_to<PhysicsDirectBodyState>(p_state);
+ RigidBody::_direct_state_changed(p_state);
- set_ignore_transform_notification(true);
- set_global_transform(s->get_transform());
- set_ignore_transform_notification(false);
+ state = Object::cast_to<PhysicsDirectBodyState>(p_state);
- float step = s->get_step();
+ float step = state->get_step();
for (int i = 0; i < wheels.size(); i++) {
- _update_wheel(i, s);
+ _update_wheel(i, state);
}
for (int i = 0; i < wheels.size(); i++) {
- _ray_cast(i, s);
- wheels[i]->set_transform(s->get_transform().inverse() * wheels[i]->m_worldTransform);
+ _ray_cast(i, state);
+ wheels[i]->set_transform(state->get_transform().inverse() * wheels[i]->m_worldTransform);
}
- _update_suspension(s);
+ _update_suspension(state);
for (int i = 0; i < wheels.size(); i++) {
@@ -848,21 +846,21 @@ void VehicleBody::_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 - s->get_transform().origin;
+ Vector3 relpos = wheel.m_raycastInfo.m_contactPointWS - state->get_transform().origin;
- s->apply_impulse(relpos, impulse);
+ state->apply_impulse(relpos, impulse);
//getRigidBody()->applyImpulse(impulse, relpos);
}
- _update_friction(s);
+ _update_friction(state);
for (int i = 0; i < wheels.size(); i++) {
VehicleWheel &wheel = *wheels[i];
- Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - s->get_transform().origin;
- Vector3 vel = s->get_linear_velocity() + (s->get_angular_velocity()).cross(relpos); // * mPos);
+ Vector3 relpos = wheel.m_raycastInfo.m_hardPointWS - state->get_transform().origin;
+ Vector3 vel = state->get_linear_velocity() + (state->get_angular_velocity()).cross(relpos); // * mPos);
if (wheel.m_raycastInfo.m_isInContact) {
- const Transform &chassisWorldTransform = s->get_transform();
+ const Transform &chassisWorldTransform = state->get_transform();
Vector3 fwd(
chassisWorldTransform.basis[0][Vector3::AXIS_Z],
@@ -883,29 +881,8 @@ void VehicleBody::_direct_state_changed(Object *p_state) {
wheel.m_deltaRotation *= real_t(0.99); //damping of rotation when not in contact
}
- linear_velocity = s->get_linear_velocity();
-}
-
-void VehicleBody::set_mass(real_t p_mass) {
-
- mass = p_mass;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_MASS, mass);
-}
-
-real_t VehicleBody::get_mass() const {
- return mass;
-}
-
-void VehicleBody::set_friction(real_t p_friction) {
-
- friction = p_friction;
- PhysicsServer::get_singleton()->body_set_param(get_rid(), PhysicsServer::BODY_PARAM_FRICTION, friction);
-}
-
-real_t VehicleBody::get_friction() const {
-
- return friction;
+ state = NULL;
}
void VehicleBody::set_engine_force(float p_engine_force) {
@@ -936,18 +913,8 @@ float VehicleBody::get_steering() const {
return m_steeringValue;
}
-Vector3 VehicleBody::get_linear_velocity() const {
- return linear_velocity;
-}
-
void VehicleBody::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_mass", "mass"), &VehicleBody::set_mass);
- ClassDB::bind_method(D_METHOD("get_mass"), &VehicleBody::get_mass);
-
- ClassDB::bind_method(D_METHOD("set_friction", "friction"), &VehicleBody::set_friction);
- ClassDB::bind_method(D_METHOD("get_friction"), &VehicleBody::get_friction);
-
ClassDB::bind_method(D_METHOD("set_engine_force", "engine_force"), &VehicleBody::set_engine_force);
ClassDB::bind_method(D_METHOD("get_engine_force"), &VehicleBody::get_engine_force);
@@ -957,21 +924,14 @@ void VehicleBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_steering", "steering"), &VehicleBody::set_steering);
ClassDB::bind_method(D_METHOD("get_steering"), &VehicleBody::get_steering);
- ClassDB::bind_method(D_METHOD("get_linear_velocity"), &VehicleBody::get_linear_velocity);
-
- ClassDB::bind_method(D_METHOD("_direct_state_changed"), &VehicleBody::_direct_state_changed);
-
ADD_GROUP("Motion", "");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "engine_force", PROPERTY_HINT_RANGE, "0.00,1024.0,0.01"), "set_engine_force", "get_engine_force");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "brake", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_brake", "get_brake");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "steering", PROPERTY_HINT_RANGE, "-180,180.0,0.01"), "set_steering", "get_steering");
- ADD_GROUP("Mass", "");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "mass", PROPERTY_HINT_RANGE, "0.01,65536,0.01"), "set_mass", "get_mass");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0.01,1,0.01"), "set_friction", "get_friction");
}
VehicleBody::VehicleBody() :
- PhysicsBody(PhysicsServer::BODY_MODE_RIGID) {
+ RigidBody() {
m_pitchControl = 0;
m_currentVehicleSpeedKmHour = real_t(0.);
@@ -982,10 +942,11 @@ VehicleBody::VehicleBody() :
friction = 1;
+ state = NULL;
ccd = false;
exclude.insert(get_rid());
- PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
+ //PhysicsServer::get_singleton()->body_set_force_integration_callback(get_rid(), this, "_direct_state_changed");
set_mass(40);
}
diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h
index 1c7dacf5ac..7810a42e8a 100644
--- a/scene/3d/vehicle_body.h
+++ b/scene/3d/vehicle_body.h
@@ -139,20 +139,13 @@ public:
VehicleWheel();
};
-class VehicleBody : public PhysicsBody {
+class VehicleBody : public RigidBody {
- GDCLASS(VehicleBody, PhysicsBody);
-
- real_t mass;
- real_t friction;
+ GDCLASS(VehicleBody, RigidBody);
float engine_force;
float brake;
- Vector3 linear_velocity;
- Vector3 angular_velocity;
- bool ccd;
-
real_t m_pitchControl;
real_t m_steeringValue;
real_t m_currentVehicleSpeedKmHour;
@@ -192,12 +185,6 @@ class VehicleBody : public PhysicsBody {
void _direct_state_changed(Object *p_state);
public:
- void set_mass(real_t p_mass);
- real_t get_mass() const;
-
- void set_friction(real_t p_friction);
- real_t get_friction() const;
-
void set_engine_force(float p_engine_force);
float get_engine_force() const;
@@ -207,8 +194,6 @@ public:
void set_steering(float p_steering);
float get_steering() const;
- Vector3 get_linear_velocity() const;
-
VehicleBody();
};