+struct rb_angle_limit
+{
+ rigidbody *rba, *rbb;
+ v3f axis;
+ float impulse, bias;
+};
+
+static int rb_angle_limit_force(
+ rigidbody *rba, v3f va,
+ rigidbody *rbb, v3f vb,
+ float max )
+{
+ v3f wva, wvb;
+ m3x3_mulv( rba->to_world, va, wva );
+ m3x3_mulv( rbb->to_world, vb, wvb );
+
+ float dt = v3_dot(wva,wvb)*0.999f,
+ ang = fabsf(dt);
+ ang = acosf( dt );
+ if( ang > max )
+ {
+ float correction = max-ang;
+
+ v3f axis;
+ v3_cross( wva, wvb, axis );
+
+ v4f rotation;
+ q_axis_angle( rotation, axis, -correction*0.25f );
+ q_mul( rotation, rba->q, rba->q );
+
+ q_axis_angle( rotation, axis, correction*0.25f );
+ q_mul( rotation, rbb->q, rbb->q );
+
+ return 1;
+ }
+
+ return 0;
+}
+
+static void rb_constraint_angle_limit( struct rb_angle_limit *limit )
+{
+
+}
+
+
+RB_DEPR