summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/body_shape.cpp28
-rw-r--r--scene/3d/body_shape.h6
-rw-r--r--scene/3d/collision_object.cpp8
-rw-r--r--scene/3d/interpolated_camera.cpp4
4 files changed, 28 insertions, 18 deletions
diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp
index b291ce7c72..947acc6549 100644
--- a/scene/3d/body_shape.cpp
+++ b/scene/3d/body_shape.cpp
@@ -44,7 +44,6 @@
void CollisionShape::_update_body() {
-
if (get_parent() && get_parent()->cast_to<CollisionObject>())
get_parent()->cast_to<CollisionObject>()->_update_shapes_from_children();
@@ -72,7 +71,7 @@ void CollisionShape::make_convex_from_brothers() {
}
}
-
+/*
void CollisionShape::_update_indicator() {
@@ -300,9 +299,12 @@ void CollisionShape::_update_indicator() {
}
-
+*/
void CollisionShape::_add_to_collision_object(Object* p_cshape) {
+ if (unparenting)
+ return;
+
CollisionObject *co=p_cshape->cast_to<CollisionObject>();
ERR_FAIL_COND(!co);
@@ -318,22 +320,25 @@ void CollisionShape::_notification(int p_what) {
switch(p_what) {
- case NOTIFICATION_ENTER_WORLD: {
- indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
+ case NOTIFICATION_ENTER_SCENE: {
+ unparenting=false;
+
+ //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario());
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
- VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform());
+ // VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform());
if (updating_body) {
_update_body();
}
} break;
- case NOTIFICATION_EXIT_WORLD: {
- if (indicator_instance.is_valid()) {
+ case NOTIFICATION_EXIT_SCENE: {
+ /* if (indicator_instance.is_valid()) {
VisualServer::get_singleton()->free(indicator_instance);
indicator_instance=RID();
- }
+ }*/
} break;
case NOTIFICATION_UNPARENTED: {
+ unparenting=true;
if (updating_body)
_update_body();
} break;
@@ -411,15 +416,16 @@ bool CollisionShape::is_trigger() const{
CollisionShape::CollisionShape() {
- indicator = VisualServer::get_singleton()->mesh_create();
+ //indicator = VisualServer::get_singleton()->mesh_create();
updating_body=true;
+ unparenting=false;
trigger=false;
}
CollisionShape::~CollisionShape() {
if (!shape.is_null())
shape->unregister_owner(this);
- VisualServer::get_singleton()->free(indicator);
+ //VisualServer::get_singleton()->free(indicator);
}
#if 0
diff --git a/scene/3d/body_shape.h b/scene/3d/body_shape.h
index d1cb229f70..b3fbaca178 100644
--- a/scene/3d/body_shape.h
+++ b/scene/3d/body_shape.h
@@ -37,19 +37,23 @@ class CollisionShape : public Spatial {
OBJ_TYPE( CollisionShape, Spatial );
OBJ_CATEGORY("3D Physics Nodes");
+ Ref<Shape> shape;
+
+ /*
RID _get_visual_instance_rid() const;
- Ref<Shape> shape;
void _update_indicator();
RID material;
RID indicator;
RID indicator_instance;
+ */
void resource_changed(RES res);
bool updating_body;
+ bool unparenting;
bool trigger;
void _update_body();
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index e9d3e73906..47d29cec1c 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -160,13 +160,13 @@ bool CollisionObject::_get(const StringName& p_name,Variant &r_ret) const {
void CollisionObject::_get_property_list( List<PropertyInfo> *p_list) const {
- p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR) );
+ p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) );
for(int i=0;i<shapes.size();i++) {
String path="shapes/"+itos(i)+"/";
- p_list->push_back( PropertyInfo(Variant::OBJECT,path+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape",PROPERTY_USAGE_NOEDITOR) );
- p_list->push_back( PropertyInfo(Variant::TRANSFORM,path+"transform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) );
- p_list->push_back( PropertyInfo(Variant::BOOL,path+"trigger",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR) );
+ p_list->push_back( PropertyInfo(Variant::OBJECT,path+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) );
+ p_list->push_back( PropertyInfo(Variant::TRANSFORM,path+"transform",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) );
+ p_list->push_back( PropertyInfo(Variant::BOOL,path+"trigger",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) );
}
}
diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp
index 4d8c9cf7a5..f795f935ae 100644
--- a/scene/3d/interpolated_camera.cpp
+++ b/scene/3d/interpolated_camera.cpp
@@ -50,7 +50,7 @@ void InterpolatedCamera::_notification(int p_what) {
float delta = speed*get_process_delta_time();
Transform target_xform = node->get_global_transform();
- Transform local_transform = get_transform();
+ Transform local_transform = get_global_transform();
local_transform = local_transform.interpolate_with(target_xform,delta);
set_global_transform(local_transform);
@@ -136,7 +136,7 @@ void InterpolatedCamera::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_target_path","target_path"),&InterpolatedCamera::set_target_path);
ObjectTypeDB::bind_method(_MD("get_target_path"),&InterpolatedCamera::get_target_path);
- ObjectTypeDB::bind_method(_MD("set_target","target"),&InterpolatedCamera::_set_target);
+ ObjectTypeDB::bind_method(_MD("set_target","target:Camera"),&InterpolatedCamera::_set_target);
ObjectTypeDB::bind_method(_MD("set_speed","speed"),&InterpolatedCamera::set_speed);
ObjectTypeDB::bind_method(_MD("get_speed"),&InterpolatedCamera::get_speed);