summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/physics_joint.cpp6
-rw-r--r--scene/3d/skeleton.cpp16
-rw-r--r--scene/3d/sprite_3d.cpp11
-rw-r--r--scene/3d/sprite_3d.h2
-rw-r--r--scene/3d/vehicle_body.cpp12
-rw-r--r--scene/3d/visibility_notifier.cpp17
6 files changed, 28 insertions, 36 deletions
diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp
index 3f03b2aab3..084d96975f 100644
--- a/scene/3d/physics_joint.cpp
+++ b/scene/3d/physics_joint.cpp
@@ -369,9 +369,6 @@ RID HingeJoint::_configure_joint(PhysicsBody *body_a,PhysicsBody *body_b) {
Transform gt = get_global_transform();
- Vector3 hingepos = gt.origin;
- Vector3 hingedir = gt.basis.get_axis(2);
-
Transform ainv = body_a->get_global_transform().affine_inverse();
Transform local_a = ainv * gt;
@@ -532,9 +529,6 @@ RID SliderJoint::_configure_joint(PhysicsBody *body_a,PhysicsBody *body_b) {
Transform gt = get_global_transform();
- Vector3 sliderpos = gt.origin;
- Vector3 sliderdir = gt.basis.get_axis(2);
-
Transform ainv = body_a->get_global_transform().affine_inverse();
Transform local_a = ainv * gt;
diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp
index d0b739e17f..c996a8123c 100644
--- a/scene/3d/skeleton.cpp
+++ b/scene/3d/skeleton.cpp
@@ -64,15 +64,17 @@ bool Skeleton::_set(const StringName& p_path, const Variant& p_value) {
else if (what=="bound_childs") {
Array children=p_value;
- bones[which].nodes_bound.clear();
+ if (is_inside_tree()) {
+ bones[which].nodes_bound.clear();
- for (int i=0;i<children.size();i++) {
+ for (int i=0;i<children.size();i++) {
- NodePath path=children[i];
- ERR_CONTINUE( path.operator String()=="" );
- Node *node = get_node(path);
- ERR_CONTINUE(!node);
- bind_child_node_to_bone(which,node);
+ NodePath path=children[i];
+ ERR_CONTINUE( path.operator String()=="" );
+ Node *node = get_node(path);
+ ERR_CONTINUE(!node);
+ bind_child_node_to_bone(which,node);
+ }
}
} else {
return false;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 8c86c4bf35..74cab30b17 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -585,6 +585,17 @@ Rect2 Sprite3D::get_item_rect() const {
return Rect2(ofs,s);
}
+
+void Sprite3D::_validate_property(PropertyInfo& property) const {
+
+ if (property.name=="frame") {
+
+ property.hint=PROPERTY_HINT_SPRITE_FRAME;
+
+ property.hint_string="0,"+itos(vframes*hframes-1)+",1";
+ }
+}
+
void Sprite3D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_texture","texture:Texture"),&Sprite3D::set_texture);
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index 41e6ba804a..31f8ec020f 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -158,6 +158,8 @@ class Sprite3D : public SpriteBase3D {
protected:
virtual void _draw();
static void _bind_methods();
+
+ virtual void _validate_property(PropertyInfo& property) const;
public:
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index 6ccf07db1e..7c7957640f 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -488,7 +488,6 @@ real_t VehicleBody::_ray_cast(int p_idx,PhysicsDirectBodyState *s) {
void VehicleBody::_update_suspension(PhysicsDirectBodyState *s)
{
- real_t deltaTime = s->get_step();
real_t chassisMass = mass;
for (int w_it=0; w_it<wheels.size(); w_it++)
@@ -596,21 +595,16 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
b2invinertia,
b2invmass);
- real_t jacDiagAB = jac.getDiagonal();
- real_t jacDiagABInv = real_t(1.) / jacDiagAB;
-
real_t rel_vel = jac.getRelativeVelocity(
s->get_linear_velocity(),
s->get_transform().basis.transposed().xform(s->get_angular_velocity()),
b2lv,
b2trans.xform(b2av));
- real_t a;
- a=jacDiagABInv;
rel_vel = normal.dot(vel);
- //todo: move this into proper structure
+ //TODO: move this into proper structure
real_t contactDamping = real_t(0.4);
#define ONLY_USE_LINEAR_MASS
#ifdef ONLY_USE_LINEAR_MASS
@@ -642,16 +636,16 @@ VehicleBody::btVehicleWheelContactPoint::btVehicleWheelContactPoint(PhysicsDirec
denom0= s->get_inverse_mass() + frictionDirectionWorld.dot(vec);
}
+ /* TODO: Why is this code unused?
if (body1) {
Vector3 r0 = frictionPosWorld - body1->get_global_transform().origin;
Vector3 c0 = (r0).cross(frictionDirectionWorld);
Vector3 vec = s->get_inverse_inertia_tensor().xform_inv(c0).cross(r0);
//denom1= body1->get_inverse_mass() + frictionDirectionWorld.dot(vec);
- denom1=0;
}
-
+ */
real_t relaxation = 1.f;
m_jacDiagABInv = relaxation/(denom0+denom1);
diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp
index 60097ad482..f3b5cde0eb 100644
--- a/scene/3d/visibility_notifier.cpp
+++ b/scene/3d/visibility_notifier.cpp
@@ -221,9 +221,6 @@ void VisibilityEnabler::_notification(int p_what){
return;
- Node *from = this;
- //find where current scene starts
-
for (Map<Node*,Variant>::Element *E=nodes.front();E;E=E->next()) {
if (!visible)
@@ -242,17 +239,9 @@ void VisibilityEnabler::_change_node_state(Node* p_node,bool p_enabled) {
{
RigidBody *rb = p_node->cast_to<RigidBody>();
- if (rb) {
-
- if (p_enabled) {
- RigidBody::Mode mode = RigidBody::Mode(nodes[p_node].operator int());
- //rb->set_mode(mode);
- rb->set_sleeping(false);
- } else {
- //rb->set_mode(RigidBody::MODE_STATIC);
- rb->set_sleeping(true);
- }
- }
+ if (rb)
+
+ rb->set_sleeping(!p_enabled);
}
{