Batch of Bugfixes
-=-=-=-=-=-=-=-=- -Fixed Export UV XForm (should work now). #923 -Fixed enforcement of limits in property editor. #919 -Fixed long-standing bug of export editings in script inheritance. #914, #859, #756 -Fixed horrible error reporting in shader language. #912 -Added kinematic collision with plane (please test well). #911 -Fixed double animation track insert when using 2D rigs. #904 -VKey updates offset parameter in sprite edition. #901 -Do not allow anymore a script to preload itself. (does not fix #899, but narrows it down) -Avoid connection editor from overriding selected text. #897 -Fixed timer autostart. #876 -Fixed collision layers in 3D physics. #872 -Improved operators in shader #857 -Fixed ambient lighting bug #834 -Avoid editor from processing gamepad input #813 -Added not keyword #752 Please test!
This commit is contained in:
parent
f7c9a4a0a8
commit
c79be979d4
35 changed files with 492 additions and 116 deletions
|
|
@ -175,7 +175,7 @@ void BodyPairSW::validate_contacts() {
|
|||
bool BodyPairSW::setup(float p_step) {
|
||||
|
||||
//cannot collide
|
||||
if (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)) {
|
||||
if ((A->get_layer_mask()&B->get_layer_mask())==0 || 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)) {
|
||||
collided=false;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,6 +275,44 @@ void CollisionSolverSW::concave_distance_callback(void *p_userdata, ShapeSW *p_c
|
|||
}
|
||||
|
||||
|
||||
|
||||
bool CollisionSolverSW::solve_distance_plane(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B) {
|
||||
|
||||
const PlaneShapeSW *plane = static_cast<const PlaneShapeSW*>(p_shape_A);
|
||||
if (p_shape_B->get_type()==PhysicsServer::SHAPE_PLANE)
|
||||
return false;
|
||||
Plane p = p_transform_A.xform(plane->get_plane());
|
||||
|
||||
static const int max_supports = 16;
|
||||
Vector3 supports[max_supports];
|
||||
int support_count;
|
||||
|
||||
p_shape_B->get_supports(p_transform_B.basis.xform_inv(-p.normal).normalized(),max_supports,supports,support_count);
|
||||
|
||||
bool collided=false;
|
||||
Vector3 closest;
|
||||
float closest_d;
|
||||
|
||||
|
||||
for(int i=0;i<support_count;i++) {
|
||||
|
||||
supports[i] = p_transform_B.xform( supports[i] );
|
||||
real_t d = p.distance_to(supports[i]);
|
||||
if (i==0 || d<closest_d) {
|
||||
closest=supports[i];
|
||||
closest_d=d;
|
||||
if (d<=0)
|
||||
collided=true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
r_point_A=p.project(closest);
|
||||
r_point_B=closest;
|
||||
|
||||
return collided;
|
||||
}
|
||||
|
||||
bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B,const AABB& p_concave_hint,Vector3 *r_sep_axis) {
|
||||
|
||||
if (p_shape_A->is_concave())
|
||||
|
|
@ -282,7 +320,11 @@ bool CollisionSolverSW::solve_distance(const ShapeSW *p_shape_A,const Transform&
|
|||
|
||||
if (p_shape_B->get_type()==PhysicsServer::SHAPE_PLANE) {
|
||||
|
||||
return false; //unsupported
|
||||
Vector3 a,b;
|
||||
bool col = solve_distance_plane(p_shape_B,p_transform_B,p_shape_A,p_transform_A,a,b);
|
||||
r_point_A=b;
|
||||
r_point_B=a;
|
||||
return !col;
|
||||
|
||||
} else if (p_shape_B->is_concave()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ private:
|
|||
static bool solve_ray(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result);
|
||||
static bool solve_concave(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result,float p_margin_A=0,float p_margin_B=0);
|
||||
static void concave_distance_callback(void *p_userdata, ShapeSW *p_convex);
|
||||
static bool solve_distance_plane(const ShapeSW *p_shape_A,const Transform& p_transform_A,const ShapeSW *p_shape_B,const Transform& p_transform_B,Vector3& r_point_A,Vector3& r_point_B);
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue