diff options
Diffstat (limited to 'servers/physics/body_pair_sw.cpp')
-rw-r--r-- | servers/physics/body_pair_sw.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp index 7defa87bb1..7fb3def387 100644 --- a/servers/physics/body_pair_sw.cpp +++ b/servers/physics/body_pair_sw.cpp @@ -105,7 +105,7 @@ void BodyPairSW::contact_added_callback(const Vector3& p_point_A,const Vector3& // remove the contact with the minimum depth int least_deep=-1; - float min_depth=1e10; + real_t min_depth=1e10; for (int i=0;i<=contact_count;i++) { @@ -114,7 +114,7 @@ void BodyPairSW::contact_added_callback(const Vector3& p_point_A,const Vector3& Vector3 global_B = B->get_transform().basis.xform(c.local_B)+offset_B; Vector3 axis = global_A - global_B; - float depth = axis.dot( c.normal ); + real_t depth = axis.dot( c.normal ); if (depth<min_depth) { @@ -154,7 +154,7 @@ void BodyPairSW::validate_contacts() { Vector3 global_A = A->get_transform().basis.xform(c.local_A); Vector3 global_B = B->get_transform().basis.xform(c.local_B)+offset_B; Vector3 axis = global_A - global_B; - float depth = axis.dot( c.normal ); + real_t depth = axis.dot( c.normal ); if (depth < -contact_max_separation || (global_B + c.normal * depth - global_A).length() > contact_max_separation) { // contact no longer needed, remove @@ -173,7 +173,7 @@ void BodyPairSW::validate_contacts() { } -bool BodyPairSW::_test_ccd(float p_step,BodySW *p_A, int p_shape_A,const Transform& p_xform_A,BodySW *p_B, int p_shape_B,const Transform& p_xform_B) { +bool BodyPairSW::_test_ccd(real_t p_step,BodySW *p_A, int p_shape_A,const Transform& p_xform_A,BodySW *p_B, int p_shape_B,const Transform& p_xform_B) { @@ -211,14 +211,14 @@ bool BodyPairSW::_test_ccd(float p_step,BodySW *p_A, int p_shape_A,const Transfo //shorten the linear velocity so it does not hit, but gets close enough, next frame will hit softly or soft enough Vector3 hitpos = p_xform_B.xform(rpos); - float newlen = hitpos.distance_to(from)-(max-min)*0.01; + real_t newlen = hitpos.distance_to(from)-(max-min)*0.01; p_A->set_linear_velocity((mnormal*newlen)/p_step); return true; } -bool BodyPairSW::setup(float p_step) { +bool BodyPairSW::setup(real_t p_step) { //cannot collide if (!A->test_collision_mask(B) || A->has_exception(B->get_self()) || B->has_exception(A->get_self()) || (A->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC && B->get_mode()<=PhysicsServer::BODY_MODE_KINEMATIC && A->get_max_contacts_reported()==0 && B->get_max_contacts_reported()==0)) { @@ -264,7 +264,7 @@ bool BodyPairSW::setup(float p_step) { real_t max_penetration = space->get_contact_max_allowed_penetration(); - float bias = 0.3f; + real_t bias = (real_t)0.3; if (shape_A_ptr->get_custom_bias() || shape_B_ptr->get_custom_bias()) { @@ -356,7 +356,7 @@ bool BodyPairSW::setup(float p_step) { if (depth > max_penetration) { c.bias = (depth - max_penetration) * (1.0/(p_step*(1.0/RELAXATION_TIMESTEPS))); } else { - float approach = -0.1f * (depth - max_penetration) / (CMP_EPSILON + max_penetration); + real_t approach = -0.1 * (depth - max_penetration) / (CMP_EPSILON + max_penetration); approach = CLAMP( approach, CMP_EPSILON, 1.0 ); c.bias = approach * (depth - max_penetration) * (1.0/p_step); } @@ -387,7 +387,7 @@ bool BodyPairSW::setup(float p_step) { return true; } -void BodyPairSW::solve(float p_step) { +void BodyPairSW::solve(real_t p_step) { if (!collided) return; |