text: // Generated by Haxe 4.0.0-preview.5
  #include <hxcpp.h>
  
  #ifndef INCLUDED_nape_constraint_Constraint
  #include <hxinc/nape/constraint/Constraint.h>
  #endif
  #ifndef INCLUDED_nape_constraint_MotorJoint
  #include <hxinc/nape/constraint/MotorJoint.h>
  #endif
  #ifndef INCLUDED_nape_geom_MatMN
  #include <hxinc/nape/geom/MatMN.h>
  #endif
  #ifndef INCLUDED_nape_geom_Vec3
  #include <hxinc/nape/geom/Vec3.h>
  #endif
  #ifndef INCLUDED_nape_phys_Body
  #include <hxinc/nape/phys/Body.h>
  #endif
  #ifndef INCLUDED_nape_phys_Interactor
  #include <hxinc/nape/phys/Interactor.h>
  #endif
  #ifndef INCLUDED_nape_space_Space
  #include <hxinc/nape/space/Space.h>
  #endif
  #ifndef INCLUDED_zpp_nape_constraint_ZPP_Constraint
  #include <hxinc/zpp_nape/constraint/ZPP_Constraint.h>
  #endif
  #ifndef INCLUDED_zpp_nape_constraint_ZPP_MotorJoint
  #include <hxinc/zpp_nape/constraint/ZPP_MotorJoint.h>
  #endif
  #ifndef INCLUDED_zpp_nape_geom_ZPP_MatMN
  #include <hxinc/zpp_nape/geom/ZPP_MatMN.h>
  #endif
  #ifndef INCLUDED_zpp_nape_phys_ZPP_Body
  #include <hxinc/zpp_nape/phys/ZPP_Body.h>
  #endif
  #ifndef INCLUDED_zpp_nape_phys_ZPP_Interactor
  #include <hxinc/zpp_nape/phys/ZPP_Interactor.h>
  #endif
  #ifndef INCLUDED_zpp_nape_space_ZPP_Space
  #include <hxinc/zpp_nape/space/ZPP_Space.h>
  #endif
  #ifndef INCLUDED_zpp_nape_util_ZNPList_ZPP_Constraint
  #include <hxinc/zpp_nape/util/ZNPList_ZPP_Constraint.h>
  #endif
  
  HX_DEFINE_STACK_FRAME(_hx_pos_75804f1aed55486c_183_new,"nape.constraint.MotorJoint","new",0xfb8e1e12,"nape.constraint.MotorJoint.new","nape/constraint/MotorJoint.hx",183,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_197_get_body1,"nape.constraint.MotorJoint","get_body1",0xfbf7ced8,"nape.constraint.MotorJoint.get_body1","nape/constraint/MotorJoint.hx",197,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_199_set_body1,"nape.constraint.MotorJoint","set_body1",0xdf48bae4,"nape.constraint.MotorJoint.set_body1","nape/constraint/MotorJoint.hx",199,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_235_get_body2,"nape.constraint.MotorJoint","get_body2",0xfbf7ced9,"nape.constraint.MotorJoint.get_body2","nape/constraint/MotorJoint.hx",235,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_237_set_body2,"nape.constraint.MotorJoint","set_body2",0xdf48bae5,"nape.constraint.MotorJoint.set_body2","nape/constraint/MotorJoint.hx",237,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_272_get_ratio,"nape.constraint.MotorJoint","get_ratio",0x292c3094,"nape.constraint.MotorJoint.get_ratio","nape/constraint/MotorJoint.hx",272,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_274_set_ratio,"nape.constraint.MotorJoint","set_ratio",0x0c7d1ca0,"nape.constraint.MotorJoint.set_ratio","nape/constraint/MotorJoint.hx",274,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_297_get_rate,"nape.constraint.MotorJoint","get_rate",0x8433db77,"nape.constraint.MotorJoint.get_rate","nape/constraint/MotorJoint.hx",297,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_299_set_rate,"nape.constraint.MotorJoint","set_rate",0x329134eb,"nape.constraint.MotorJoint.set_rate","nape/constraint/MotorJoint.hx",299,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_348_impulse,"nape.constraint.MotorJoint","impulse",0xe5f55f67,"nape.constraint.MotorJoint.impulse","nape/constraint/MotorJoint.hx",348,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_358_bodyImpulse,"nape.constraint.MotorJoint","bodyImpulse",0x6d4cc5e5,"nape.constraint.MotorJoint.bodyImpulse","nape/constraint/MotorJoint.hx",358,0x6a1b57fe)
  HX_LOCAL_STACK_FRAME(_hx_pos_75804f1aed55486c_377_visitBodies,"nape.constraint.MotorJoint","visitBodies",0xf209435d,"nape.constraint.MotorJoint.visitBodies","nape/constraint/MotorJoint.hx",377,0x6a1b57fe)
  namespace nape{
  namespace constraint{
  
  void MotorJoint_obj::__construct( ::nape::phys::Body body1, ::nape::phys::Body body2,hx::Null< Float >  __o_rate,hx::Null< Float >  __o_ratio){
              		Float rate = __o_rate.Default(((Float)0.0));
              		Float ratio = __o_ratio.Default(((Float)1.0));
              	HX_GC_STACKFRAME(&_hx_pos_75804f1aed55486c_183_new)
  HXLINE( 187)		this->zpp_inner_zn = null();
  HXLINE( 326)		this->zpp_inner_zn =  ::zpp_nape::constraint::ZPP_MotorJoint_obj::__alloc( HX_CTX );
  HXLINE( 327)		this->zpp_inner = this->zpp_inner_zn;
  HXLINE( 328)		this->zpp_inner->outer = hx::ObjectPtr<OBJ_>(this);
  HXLINE( 329)		this->zpp_inner_zn->outer_zn = hx::ObjectPtr<OBJ_>(this);
  HXLINE( 331)		::nape::constraint::Constraint_obj::zpp_internalAlloc = true;
  HXLINE( 332)		super::__construct();
  HXLINE( 333)		::nape::constraint::Constraint_obj::zpp_internalAlloc = false;
  HXLINE( 338)		{
  HXLINE( 338)			{
  HXLINE( 338)				this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body1",4f,d3,ef,b6)));
  HXDLIN( 338)				 ::zpp_nape::phys::ZPP_Body inbody1;
  HXDLIN( 338)				if (hx::IsNull( body1 )) {
  HXLINE( 338)					inbody1 = null();
              				}
              				else {
  HXLINE( 338)					inbody1 = body1->zpp_inner;
              				}
  HXDLIN( 338)				if (hx::IsNotEq( inbody1,this->zpp_inner_zn->b1 )) {
  HXLINE( 338)					if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 338)						bool _hx_tmp;
  HXDLIN( 338)						 ::nape::space::Space _hx_tmp1;
  HXDLIN( 338)						if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 338)							_hx_tmp1 = null();
              						}
              						else {
  HXLINE( 338)							_hx_tmp1 = this->zpp_inner->space->outer;
              						}
  HXDLIN( 338)						if (hx::IsNotNull( _hx_tmp1 )) {
  HXLINE( 338)							_hx_tmp = hx::IsNotEq( this->zpp_inner_zn->b2,this->zpp_inner_zn->b1 );
              						}
              						else {
  HXLINE( 338)							_hx_tmp = false;
              						}
  HXDLIN( 338)						if (_hx_tmp) {
  HXLINE( 338)							if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 338)								this->zpp_inner_zn->b1->constraints->remove(this->zpp_inner);
              							}
              						}
  HXDLIN( 338)						bool _hx_tmp2;
  HXDLIN( 338)						if (this->zpp_inner->active) {
  HXLINE( 338)							 ::nape::space::Space _hx_tmp3;
  HXDLIN( 338)							if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 338)								_hx_tmp3 = null();
              							}
              							else {
  HXLINE( 338)								_hx_tmp3 = this->zpp_inner->space->outer;
              							}
  HXDLIN( 338)							_hx_tmp2 = hx::IsNotNull( _hx_tmp3 );
              						}
              						else {
  HXLINE( 338)							_hx_tmp2 = false;
              						}
  HXDLIN( 338)						if (_hx_tmp2) {
  HXLINE( 338)							this->zpp_inner_zn->b1->wake();
              						}
              					}
  HXDLIN( 338)					this->zpp_inner_zn->b1 = inbody1;
  HXDLIN( 338)					bool _hx_tmp4;
  HXDLIN( 338)					bool _hx_tmp5;
  HXDLIN( 338)					 ::nape::space::Space _hx_tmp6;
  HXDLIN( 338)					if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 338)						_hx_tmp6 = null();
              					}
              					else {
  HXLINE( 338)						_hx_tmp6 = this->zpp_inner->space->outer;
              					}
  HXDLIN( 338)					if (hx::IsNotNull( _hx_tmp6 )) {
  HXLINE( 338)						_hx_tmp5 = hx::IsNotNull( inbody1 );
              					}
              					else {
  HXLINE( 338)						_hx_tmp5 = false;
              					}
  HXDLIN( 338)					if (_hx_tmp5) {
  HXLINE( 338)						_hx_tmp4 = hx::IsNotEq( this->zpp_inner_zn->b2,inbody1 );
              					}
              					else {
  HXLINE( 338)						_hx_tmp4 = false;
              					}
  HXDLIN( 338)					if (_hx_tmp4) {
  HXLINE( 338)						if (hx::IsNotNull( inbody1 )) {
  HXLINE( 338)							inbody1->constraints->add(this->zpp_inner);
              						}
              					}
  HXDLIN( 338)					bool _hx_tmp7;
  HXDLIN( 338)					if (this->zpp_inner->active) {
  HXLINE( 338)						 ::nape::space::Space _hx_tmp8;
  HXDLIN( 338)						if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 338)							_hx_tmp8 = null();
              						}
              						else {
  HXLINE( 338)							_hx_tmp8 = this->zpp_inner->space->outer;
              						}
  HXDLIN( 338)						_hx_tmp7 = hx::IsNotNull( _hx_tmp8 );
              					}
              					else {
  HXLINE( 338)						_hx_tmp7 = false;
              					}
  HXDLIN( 338)					if (_hx_tmp7) {
  HXLINE( 338)						this->zpp_inner->wake();
  HXDLIN( 338)						if (hx::IsNotNull( inbody1 )) {
  HXLINE( 338)							inbody1->wake();
              						}
              					}
              				}
              			}
  HXDLIN( 338)			bool _hx_tmp9 = hx::IsNull( this->zpp_inner_zn->b1 );
              		}
  HXLINE( 339)		{
  HXLINE( 339)			{
  HXLINE( 339)				this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body2",50,d3,ef,b6)));
  HXDLIN( 339)				 ::zpp_nape::phys::ZPP_Body inbody2;
  HXDLIN( 339)				if (hx::IsNull( body2 )) {
  HXLINE( 339)					inbody2 = null();
              				}
              				else {
  HXLINE( 339)					inbody2 = body2->zpp_inner;
              				}
  HXDLIN( 339)				if (hx::IsNotEq( inbody2,this->zpp_inner_zn->b2 )) {
  HXLINE( 339)					if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 339)						bool _hx_tmp10;
  HXDLIN( 339)						 ::nape::space::Space _hx_tmp11;
  HXDLIN( 339)						if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 339)							_hx_tmp11 = null();
              						}
              						else {
  HXLINE( 339)							_hx_tmp11 = this->zpp_inner->space->outer;
              						}
  HXDLIN( 339)						if (hx::IsNotNull( _hx_tmp11 )) {
  HXLINE( 339)							_hx_tmp10 = hx::IsNotEq( this->zpp_inner_zn->b1,this->zpp_inner_zn->b2 );
              						}
              						else {
  HXLINE( 339)							_hx_tmp10 = false;
              						}
  HXDLIN( 339)						if (_hx_tmp10) {
  HXLINE( 339)							if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 339)								this->zpp_inner_zn->b2->constraints->remove(this->zpp_inner);
              							}
              						}
  HXDLIN( 339)						bool _hx_tmp12;
  HXDLIN( 339)						if (this->zpp_inner->active) {
  HXLINE( 339)							 ::nape::space::Space _hx_tmp13;
  HXDLIN( 339)							if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 339)								_hx_tmp13 = null();
              							}
              							else {
  HXLINE( 339)								_hx_tmp13 = this->zpp_inner->space->outer;
              							}
  HXDLIN( 339)							_hx_tmp12 = hx::IsNotNull( _hx_tmp13 );
              						}
              						else {
  HXLINE( 339)							_hx_tmp12 = false;
              						}
  HXDLIN( 339)						if (_hx_tmp12) {
  HXLINE( 339)							this->zpp_inner_zn->b2->wake();
              						}
              					}
  HXDLIN( 339)					this->zpp_inner_zn->b2 = inbody2;
  HXDLIN( 339)					bool _hx_tmp14;
  HXDLIN( 339)					bool _hx_tmp15;
  HXDLIN( 339)					 ::nape::space::Space _hx_tmp16;
  HXDLIN( 339)					if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 339)						_hx_tmp16 = null();
              					}
              					else {
  HXLINE( 339)						_hx_tmp16 = this->zpp_inner->space->outer;
              					}
  HXDLIN( 339)					if (hx::IsNotNull( _hx_tmp16 )) {
  HXLINE( 339)						_hx_tmp15 = hx::IsNotNull( inbody2 );
              					}
              					else {
  HXLINE( 339)						_hx_tmp15 = false;
              					}
  HXDLIN( 339)					if (_hx_tmp15) {
  HXLINE( 339)						_hx_tmp14 = hx::IsNotEq( this->zpp_inner_zn->b1,inbody2 );
              					}
              					else {
  HXLINE( 339)						_hx_tmp14 = false;
              					}
  HXDLIN( 339)					if (_hx_tmp14) {
  HXLINE( 339)						if (hx::IsNotNull( inbody2 )) {
  HXLINE( 339)							inbody2->constraints->add(this->zpp_inner);
              						}
              					}
  HXDLIN( 339)					bool _hx_tmp17;
  HXDLIN( 339)					if (this->zpp_inner->active) {
  HXLINE( 339)						 ::nape::space::Space _hx_tmp18;
  HXDLIN( 339)						if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 339)							_hx_tmp18 = null();
              						}
              						else {
  HXLINE( 339)							_hx_tmp18 = this->zpp_inner->space->outer;
              						}
  HXDLIN( 339)						_hx_tmp17 = hx::IsNotNull( _hx_tmp18 );
              					}
              					else {
  HXLINE( 339)						_hx_tmp17 = false;
              					}
  HXDLIN( 339)					if (_hx_tmp17) {
  HXLINE( 339)						this->zpp_inner->wake();
  HXDLIN( 339)						if (hx::IsNotNull( inbody2 )) {
  HXLINE( 339)							inbody2->wake();
              						}
              					}
              				}
              			}
  HXDLIN( 339)			bool _hx_tmp19 = hx::IsNull( this->zpp_inner_zn->b2 );
              		}
  HXLINE( 340)		{
  HXLINE( 340)			this->zpp_inner->immutable_midstep(HX_("MotorJoint::rate",15,70,6a,b1));
  HXDLIN( 340)			if ((rate != rate)) {
  HXLINE( 340)				HX_STACK_DO_THROW(HX_("Error: MotorJoint::rate cannot be NaN",be,52,ea,bc));
              			}
  HXDLIN( 340)			if ((this->zpp_inner_zn->rate != rate)) {
  HXLINE( 340)				this->zpp_inner_zn->rate = rate;
  HXDLIN( 340)				this->zpp_inner->wake();
              			}
              		}
  HXLINE( 341)		{
  HXLINE( 341)			this->zpp_inner->immutable_midstep(HX_("MotorJoint::ratio",36,a6,b7,8b));
  HXDLIN( 341)			if ((ratio != ratio)) {
  HXLINE( 341)				HX_STACK_DO_THROW(HX_("Error: MotorJoint::ratio cannot be NaN",43,b3,11,7e));
              			}
  HXDLIN( 341)			if ((this->zpp_inner_zn->ratio != ratio)) {
  HXLINE( 341)				this->zpp_inner_zn->ratio = ratio;
  HXDLIN( 341)				this->zpp_inner->wake();
              			}
              		}
              	}
  
  Dynamic MotorJoint_obj::__CreateEmpty() { return new MotorJoint_obj; }
  
  void *MotorJoint_obj::_hx_vtable = 0;
  
  Dynamic MotorJoint_obj::__Create(hx::DynamicArray inArgs)
  {
  	hx::ObjectPtr< MotorJoint_obj > _hx_result = new MotorJoint_obj();
  	_hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3]);
  	return _hx_result;
  }
  
  bool MotorJoint_obj::_hx_isInstanceOf(int inClassId) {
  	if (inClassId<=(int)0x00e9fd26) {
  		return inClassId==(int)0x00000001 || inClassId==(int)0x00e9fd26;
  	} else {
  		return inClassId==(int)0x19d37efa;
  	}
  }
  
   ::nape::phys::Body MotorJoint_obj::get_body1(){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_197_get_body1)
  HXDLIN( 197)		if (hx::IsNull( this->zpp_inner_zn->b1 )) {
  HXDLIN( 197)			return null();
              		}
              		else {
  HXDLIN( 197)			return this->zpp_inner_zn->b1->outer;
              		}
  HXDLIN( 197)		return null();
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC0(MotorJoint_obj,get_body1,return )
  
   ::nape::phys::Body MotorJoint_obj::set_body1( ::nape::phys::Body body1){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_199_set_body1)
  HXLINE( 200)		{
  HXLINE( 201)			this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body1",4f,d3,ef,b6)));
  HXLINE( 202)			 ::zpp_nape::phys::ZPP_Body inbody1;
  HXDLIN( 202)			if (hx::IsNull( body1 )) {
  HXLINE( 202)				inbody1 = null();
              			}
              			else {
  HXLINE( 202)				inbody1 = body1->zpp_inner;
              			}
  HXLINE( 203)			if (hx::IsNotEq( inbody1,this->zpp_inner_zn->b1 )) {
  HXLINE( 204)				if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 205)					bool _hx_tmp;
  HXDLIN( 205)					 ::nape::space::Space _hx_tmp1;
  HXDLIN( 205)					if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 205)						_hx_tmp1 = null();
              					}
              					else {
  HXLINE( 205)						_hx_tmp1 = this->zpp_inner->space->outer;
              					}
  HXDLIN( 205)					if (hx::IsNotNull( _hx_tmp1 )) {
  HXLINE( 205)						_hx_tmp = hx::IsNotEq( this->zpp_inner_zn->b2,this->zpp_inner_zn->b1 );
              					}
              					else {
  HXLINE( 205)						_hx_tmp = false;
              					}
  HXDLIN( 205)					if (_hx_tmp) {
  HXLINE( 207)						if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 207)							this->zpp_inner_zn->b1->constraints->remove(this->zpp_inner);
              						}
              					}
  HXLINE( 210)					bool _hx_tmp2;
  HXDLIN( 210)					if (this->zpp_inner->active) {
  HXLINE( 210)						 ::nape::space::Space _hx_tmp3;
  HXDLIN( 210)						if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 210)							_hx_tmp3 = null();
              						}
              						else {
  HXLINE( 210)							_hx_tmp3 = this->zpp_inner->space->outer;
              						}
  HXDLIN( 210)						_hx_tmp2 = hx::IsNotNull( _hx_tmp3 );
              					}
              					else {
  HXLINE( 210)						_hx_tmp2 = false;
              					}
  HXDLIN( 210)					if (_hx_tmp2) {
  HXLINE( 210)						this->zpp_inner_zn->b1->wake();
              					}
              				}
  HXLINE( 212)				this->zpp_inner_zn->b1 = inbody1;
  HXLINE( 213)				bool _hx_tmp4;
  HXDLIN( 213)				bool _hx_tmp5;
  HXDLIN( 213)				 ::nape::space::Space _hx_tmp6;
  HXDLIN( 213)				if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 213)					_hx_tmp6 = null();
              				}
              				else {
  HXLINE( 213)					_hx_tmp6 = this->zpp_inner->space->outer;
              				}
  HXDLIN( 213)				if (hx::IsNotNull( _hx_tmp6 )) {
  HXLINE( 213)					_hx_tmp5 = hx::IsNotNull( inbody1 );
              				}
              				else {
  HXLINE( 213)					_hx_tmp5 = false;
              				}
  HXDLIN( 213)				if (_hx_tmp5) {
  HXLINE( 213)					_hx_tmp4 = hx::IsNotEq( this->zpp_inner_zn->b2,inbody1 );
              				}
              				else {
  HXLINE( 213)					_hx_tmp4 = false;
              				}
  HXDLIN( 213)				if (_hx_tmp4) {
  HXLINE( 215)					if (hx::IsNotNull( inbody1 )) {
  HXLINE( 215)						inbody1->constraints->add(this->zpp_inner);
              					}
              				}
  HXLINE( 218)				bool _hx_tmp7;
  HXDLIN( 218)				if (this->zpp_inner->active) {
  HXLINE( 218)					 ::nape::space::Space _hx_tmp8;
  HXDLIN( 218)					if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 218)						_hx_tmp8 = null();
              					}
              					else {
  HXLINE( 218)						_hx_tmp8 = this->zpp_inner->space->outer;
              					}
  HXDLIN( 218)					_hx_tmp7 = hx::IsNotNull( _hx_tmp8 );
              				}
              				else {
  HXLINE( 218)					_hx_tmp7 = false;
              				}
  HXDLIN( 218)				if (_hx_tmp7) {
  HXLINE( 219)					this->zpp_inner->wake();
  HXLINE( 220)					if (hx::IsNotNull( inbody1 )) {
  HXLINE( 220)						inbody1->wake();
              					}
              				}
              			}
              		}
  HXLINE( 224)		if (hx::IsNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 224)			return null();
              		}
              		else {
  HXLINE( 224)			return this->zpp_inner_zn->b1->outer;
              		}
  HXDLIN( 224)		return null();
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC1(MotorJoint_obj,set_body1,return )
  
   ::nape::phys::Body MotorJoint_obj::get_body2(){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_235_get_body2)
  HXDLIN( 235)		if (hx::IsNull( this->zpp_inner_zn->b2 )) {
  HXDLIN( 235)			return null();
              		}
              		else {
  HXDLIN( 235)			return this->zpp_inner_zn->b2->outer;
              		}
  HXDLIN( 235)		return null();
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC0(MotorJoint_obj,get_body2,return )
  
   ::nape::phys::Body MotorJoint_obj::set_body2( ::nape::phys::Body body2){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_237_set_body2)
  HXLINE( 238)		{
  HXLINE( 239)			this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body2",50,d3,ef,b6)));
  HXLINE( 240)			 ::zpp_nape::phys::ZPP_Body inbody2;
  HXDLIN( 240)			if (hx::IsNull( body2 )) {
  HXLINE( 240)				inbody2 = null();
              			}
              			else {
  HXLINE( 240)				inbody2 = body2->zpp_inner;
              			}
  HXLINE( 241)			if (hx::IsNotEq( inbody2,this->zpp_inner_zn->b2 )) {
  HXLINE( 242)				if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 243)					bool _hx_tmp;
  HXDLIN( 243)					 ::nape::space::Space _hx_tmp1;
  HXDLIN( 243)					if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 243)						_hx_tmp1 = null();
              					}
              					else {
  HXLINE( 243)						_hx_tmp1 = this->zpp_inner->space->outer;
              					}
  HXDLIN( 243)					if (hx::IsNotNull( _hx_tmp1 )) {
  HXLINE( 243)						_hx_tmp = hx::IsNotEq( this->zpp_inner_zn->b1,this->zpp_inner_zn->b2 );
              					}
              					else {
  HXLINE( 243)						_hx_tmp = false;
              					}
  HXDLIN( 243)					if (_hx_tmp) {
  HXLINE( 245)						if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 245)							this->zpp_inner_zn->b2->constraints->remove(this->zpp_inner);
              						}
              					}
  HXLINE( 248)					bool _hx_tmp2;
  HXDLIN( 248)					if (this->zpp_inner->active) {
  HXLINE( 248)						 ::nape::space::Space _hx_tmp3;
  HXDLIN( 248)						if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 248)							_hx_tmp3 = null();
              						}
              						else {
  HXLINE( 248)							_hx_tmp3 = this->zpp_inner->space->outer;
              						}
  HXDLIN( 248)						_hx_tmp2 = hx::IsNotNull( _hx_tmp3 );
              					}
              					else {
  HXLINE( 248)						_hx_tmp2 = false;
              					}
  HXDLIN( 248)					if (_hx_tmp2) {
  HXLINE( 248)						this->zpp_inner_zn->b2->wake();
              					}
              				}
  HXLINE( 250)				this->zpp_inner_zn->b2 = inbody2;
  HXLINE( 251)				bool _hx_tmp4;
  HXDLIN( 251)				bool _hx_tmp5;
  HXDLIN( 251)				 ::nape::space::Space _hx_tmp6;
  HXDLIN( 251)				if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 251)					_hx_tmp6 = null();
              				}
              				else {
  HXLINE( 251)					_hx_tmp6 = this->zpp_inner->space->outer;
              				}
  HXDLIN( 251)				if (hx::IsNotNull( _hx_tmp6 )) {
  HXLINE( 251)					_hx_tmp5 = hx::IsNotNull( inbody2 );
              				}
              				else {
  HXLINE( 251)					_hx_tmp5 = false;
              				}
  HXDLIN( 251)				if (_hx_tmp5) {
  HXLINE( 251)					_hx_tmp4 = hx::IsNotEq( this->zpp_inner_zn->b1,inbody2 );
              				}
              				else {
  HXLINE( 251)					_hx_tmp4 = false;
              				}
  HXDLIN( 251)				if (_hx_tmp4) {
  HXLINE( 253)					if (hx::IsNotNull( inbody2 )) {
  HXLINE( 253)						inbody2->constraints->add(this->zpp_inner);
              					}
              				}
  HXLINE( 256)				bool _hx_tmp7;
  HXDLIN( 256)				if (this->zpp_inner->active) {
  HXLINE( 256)					 ::nape::space::Space _hx_tmp8;
  HXDLIN( 256)					if (hx::IsNull( this->zpp_inner->space )) {
  HXLINE( 256)						_hx_tmp8 = null();
              					}
              					else {
  HXLINE( 256)						_hx_tmp8 = this->zpp_inner->space->outer;
              					}
  HXDLIN( 256)					_hx_tmp7 = hx::IsNotNull( _hx_tmp8 );
              				}
              				else {
  HXLINE( 256)					_hx_tmp7 = false;
              				}
  HXDLIN( 256)				if (_hx_tmp7) {
  HXLINE( 257)					this->zpp_inner->wake();
  HXLINE( 258)					if (hx::IsNotNull( inbody2 )) {
  HXLINE( 258)						inbody2->wake();
              					}
              				}
              			}
              		}
  HXLINE( 262)		if (hx::IsNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 262)			return null();
              		}
              		else {
  HXLINE( 262)			return this->zpp_inner_zn->b2->outer;
              		}
  HXDLIN( 262)		return null();
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC1(MotorJoint_obj,set_body2,return )
  
  Float MotorJoint_obj::get_ratio(){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_272_get_ratio)
  HXDLIN( 272)		return this->zpp_inner_zn->ratio;
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC0(MotorJoint_obj,get_ratio,return )
  
  Float MotorJoint_obj::set_ratio(Float ratio){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_274_set_ratio)
  HXLINE( 275)		{
  HXLINE( 276)			this->zpp_inner->immutable_midstep(HX_("MotorJoint::ratio",36,a6,b7,8b));
  HXLINE( 278)			if ((ratio != ratio)) {
  HXLINE( 279)				HX_STACK_DO_THROW(HX_("Error: MotorJoint::ratio cannot be NaN",43,b3,11,7e));
              			}
  HXLINE( 282)			if ((this->zpp_inner_zn->ratio != ratio)) {
  HXLINE( 283)				this->zpp_inner_zn->ratio = ratio;
  HXLINE( 284)				this->zpp_inner->wake();
              			}
              		}
  HXLINE( 287)		return this->zpp_inner_zn->ratio;
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC1(MotorJoint_obj,set_ratio,return )
  
  Float MotorJoint_obj::get_rate(){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_297_get_rate)
  HXDLIN( 297)		return this->zpp_inner_zn->rate;
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC0(MotorJoint_obj,get_rate,return )
  
  Float MotorJoint_obj::set_rate(Float rate){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_299_set_rate)
  HXLINE( 300)		{
  HXLINE( 301)			this->zpp_inner->immutable_midstep(HX_("MotorJoint::rate",15,70,6a,b1));
  HXLINE( 303)			if ((rate != rate)) {
  HXLINE( 304)				HX_STACK_DO_THROW(HX_("Error: MotorJoint::rate cannot be NaN",be,52,ea,bc));
              			}
  HXLINE( 307)			if ((this->zpp_inner_zn->rate != rate)) {
  HXLINE( 308)				this->zpp_inner_zn->rate = rate;
  HXLINE( 309)				this->zpp_inner->wake();
              			}
              		}
  HXLINE( 312)		return this->zpp_inner_zn->rate;
              	}
  
  
  HX_DEFINE_DYNAMIC_FUNC1(MotorJoint_obj,set_rate,return )
  
   ::nape::geom::MatMN MotorJoint_obj::impulse(){
              	HX_GC_STACKFRAME(&_hx_pos_75804f1aed55486c_348_impulse)
  HXLINE( 349)		 ::nape::geom::MatMN ret =  ::nape::geom::MatMN_obj::__alloc( HX_CTX ,1,1);
  HXLINE( 350)		{
  HXLINE( 350)			bool _hx_tmp;
  HXDLIN( 350)			if ((0 < ret->zpp_inner->m)) {
  HXLINE( 350)				_hx_tmp = (0 >= ret->zpp_inner->n);
              			}
              			else {
  HXLINE( 350)				_hx_tmp = true;
              			}
  HXDLIN( 350)			if (_hx_tmp) {
  HXLINE( 350)				HX_STACK_DO_THROW(HX_("Error: MatMN indices out of range",cc,72,58,e6));
              			}
  HXDLIN( 350)			ret->zpp_inner->x[(0 * ret->zpp_inner->n)] = this->zpp_inner_zn->jAcc;
              		}
  HXLINE( 351)		return ret;
              	}
  
  
   ::nape::geom::Vec3 MotorJoint_obj::bodyImpulse( ::nape::phys::Body body){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_358_bodyImpulse)
  HXLINE( 360)		if (hx::IsNull( body )) {
  HXLINE( 361)			HX_STACK_DO_THROW(HX_("Error: Cannot evaluate impulse on null body",9d,b5,dc,16));
              		}
  HXLINE( 363)		bool _hx_tmp;
  HXDLIN( 363)		 ::nape::phys::Body _hx_tmp1;
  HXDLIN( 363)		if (hx::IsNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 363)			_hx_tmp1 = null();
              		}
              		else {
  HXLINE( 363)			_hx_tmp1 = this->zpp_inner_zn->b1->outer;
              		}
  HXDLIN( 363)		if (hx::IsNotEq( body,_hx_tmp1 )) {
  HXLINE( 363)			 ::nape::phys::Body _hx_tmp2;
  HXDLIN( 363)			if (hx::IsNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 363)				_hx_tmp2 = null();
              			}
              			else {
  HXLINE( 363)				_hx_tmp2 = this->zpp_inner_zn->b2->outer;
              			}
  HXDLIN( 363)			_hx_tmp = hx::IsNotEq( body,_hx_tmp2 );
              		}
              		else {
  HXLINE( 363)			_hx_tmp = false;
              		}
  HXDLIN( 363)		if (_hx_tmp) {
  HXLINE( 364)			HX_STACK_DO_THROW(HX_("Error: Body is not linked to this constraint",2e,e5,48,bf));
              		}
  HXLINE( 367)		if (!(this->zpp_inner->active)) {
  HXLINE( 368)			return ::nape::geom::Vec3_obj::get(null(),null(),null());
              		}
              		else {
  HXLINE( 371)			return this->zpp_inner_zn->bodyImpulse(body->zpp_inner);
              		}
  HXLINE( 367)		return null();
              	}
  
  
  void MotorJoint_obj::visitBodies( ::Dynamic lambda){
              	HX_STACKFRAME(&_hx_pos_75804f1aed55486c_377_visitBodies)
  HXLINE( 378)		 ::nape::phys::Body _hx_tmp;
  HXDLIN( 378)		if (hx::IsNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 378)			_hx_tmp = null();
              		}
              		else {
  HXLINE( 378)			_hx_tmp = this->zpp_inner_zn->b1->outer;
              		}
  HXDLIN( 378)		if (hx::IsNotNull( _hx_tmp )) {
  HXLINE( 379)			 ::nape::phys::Body _hx_tmp1;
  HXDLIN( 379)			if (hx::IsNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 379)				_hx_tmp1 = null();
              			}
              			else {
  HXLINE( 379)				_hx_tmp1 = this->zpp_inner_zn->b1->outer;
              			}
  HXDLIN( 379)			lambda(_hx_tmp1);
              		}
  HXLINE( 381)		bool _hx_tmp2;
  HXDLIN( 381)		 ::nape::phys::Body _hx_tmp3;
  HXDLIN( 381)		if (hx::IsNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 381)			_hx_tmp3 = null();
              		}
              		else {
  HXLINE( 381)			_hx_tmp3 = this->zpp_inner_zn->b2->outer;
              		}
  HXDLIN( 381)		if (hx::IsNotNull( _hx_tmp3 )) {
  HXLINE( 381)			 ::nape::phys::Body _hx_tmp4;
  HXDLIN( 381)			if (hx::IsNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 381)				_hx_tmp4 = null();
              			}
              			else {
  HXLINE( 381)				_hx_tmp4 = this->zpp_inner_zn->b2->outer;
              			}
  HXDLIN( 381)			 ::nape::phys::Body _hx_tmp5;
  HXDLIN( 381)			if (hx::IsNull( this->zpp_inner_zn->b1 )) {
  HXLINE( 381)				_hx_tmp5 = null();
              			}
              			else {
  HXLINE( 381)				_hx_tmp5 = this->zpp_inner_zn->b1->outer;
              			}
  HXDLIN( 381)			_hx_tmp2 = hx::IsNotEq( _hx_tmp4,_hx_tmp5 );
              		}
              		else {
  HXLINE( 381)			_hx_tmp2 = false;
              		}
  HXDLIN( 381)		if (_hx_tmp2) {
  HXLINE( 382)			 ::nape::phys::Body _hx_tmp6;
  HXDLIN( 382)			if (hx::IsNull( this->zpp_inner_zn->b2 )) {
  HXLINE( 382)				_hx_tmp6 = null();
              			}
              			else {
  HXLINE( 382)				_hx_tmp6 = this->zpp_inner_zn->b2->outer;
              			}
  HXDLIN( 382)			lambda(_hx_tmp6);
              		}
              	}
  
  
  
  hx::ObjectPtr< MotorJoint_obj > MotorJoint_obj::__new( ::nape::phys::Body body1, ::nape::phys::Body body2,hx::Null< Float >  __o_rate,hx::Null< Float >  __o_ratio) {
  	hx::ObjectPtr< MotorJoint_obj > __this = new MotorJoint_obj();
  	__this->__construct(body1,body2,__o_rate,__o_ratio);
  	return __this;
  }
  
  hx::ObjectPtr< MotorJoint_obj > MotorJoint_obj::__alloc(hx::Ctx *_hx_ctx, ::nape::phys::Body body1, ::nape::phys::Body body2,hx::Null< Float >  __o_rate,hx::Null< Float >  __o_ratio) {
  	MotorJoint_obj *__this = (MotorJoint_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(MotorJoint_obj), true, "nape.constraint.MotorJoint"));
  	*(void **)__this = MotorJoint_obj::_hx_vtable;
  	__this->__construct(body1,body2,__o_rate,__o_ratio);
  	return __this;
  }
  
  MotorJoint_obj::MotorJoint_obj()
  {
  }
  
  void MotorJoint_obj::__Mark(HX_MARK_PARAMS)
  {
  	HX_MARK_BEGIN_CLASS(MotorJoint);
  	HX_MARK_MEMBER_NAME(zpp_inner_zn,"zpp_inner_zn");
  	 ::nape::constraint::Constraint_obj::__Mark(HX_MARK_ARG);
  	HX_MARK_END_CLASS();
  }
  
  void MotorJoint_obj::__Visit(HX_VISIT_PARAMS)
  {
  	HX_VISIT_MEMBER_NAME(zpp_inner_zn,"zpp_inner_zn");
  	 ::nape::constraint::Constraint_obj::__Visit(HX_VISIT_ARG);
  }
  
  hx::Val MotorJoint_obj::__Field(const ::String &inName,hx::PropertyAccess inCallProp)
  {
  	switch(inName.length) {
  	case 4:
  		if (HX_FIELD_EQ(inName,"rate") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_rate() ); }
  		break;
  	case 5:
  		if (HX_FIELD_EQ(inName,"body1") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_body1() ); }
  		if (HX_FIELD_EQ(inName,"body2") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_body2() ); }
  		if (HX_FIELD_EQ(inName,"ratio") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_ratio() ); }
  		break;
  	case 7:
  		if (HX_FIELD_EQ(inName,"impulse") ) { return hx::Val( impulse_dyn() ); }
  		break;
  	case 8:
  		if (HX_FIELD_EQ(inName,"get_rate") ) { return hx::Val( get_rate_dyn() ); }
  		if (HX_FIELD_EQ(inName,"set_rate") ) { return hx::Val( set_rate_dyn() ); }
  		break;
  	case 9:
  		if (HX_FIELD_EQ(inName,"get_body1") ) { return hx::Val( get_body1_dyn() ); }
  		if (HX_FIELD_EQ(inName,"set_body1") ) { return hx::Val( set_body1_dyn() ); }
  		if (HX_FIELD_EQ(inName,"get_body2") ) { return hx::Val( get_body2_dyn() ); }
  		if (HX_FIELD_EQ(inName,"set_body2") ) { return hx::Val( set_body2_dyn() ); }
  		if (HX_FIELD_EQ(inName,"get_ratio") ) { return hx::Val( get_ratio_dyn() ); }
  		if (HX_FIELD_EQ(inName,"set_ratio") ) { return hx::Val( set_ratio_dyn() ); }
  		break;
  	case 11:
  		if (HX_FIELD_EQ(inName,"bodyImpulse") ) { return hx::Val( bodyImpulse_dyn() ); }
  		if (HX_FIELD_EQ(inName,"visitBodies") ) { return hx::Val( visitBodies_dyn() ); }
  		break;
  	case 12:
  		if (HX_FIELD_EQ(inName,"zpp_inner_zn") ) { return hx::Val( zpp_inner_zn ); }
  	}
  	return super::__Field(inName,inCallProp);
  }
  
  hx::Val MotorJoint_obj::__SetField(const ::String &inName,const hx::Val &inValue,hx::PropertyAccess inCallProp)
  {
  	switch(inName.length) {
  	case 4:
  		if (HX_FIELD_EQ(inName,"rate") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_rate(inValue.Cast< Float >()) ); }
  		break;
  	case 5:
  		if (HX_FIELD_EQ(inName,"body1") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_body1(inValue.Cast<  ::nape::phys::Body >()) ); }
  		if (HX_FIELD_EQ(inName,"body2") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_body2(inValue.Cast<  ::nape::phys::Body >()) ); }
  		if (HX_FIELD_EQ(inName,"ratio") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_ratio(inValue.Cast< Float >()) ); }
  		break;
  	case 12:
  		if (HX_FIELD_EQ(inName,"zpp_inner_zn") ) { zpp_inner_zn=inValue.Cast<  ::zpp_nape::constraint::ZPP_MotorJoint >(); return inValue; }
  	}
  	return super::__SetField(inName,inValue,inCallProp);
  }
  
  void MotorJoint_obj::__GetFields(Array< ::String> &outFields)
  {
  	outFields->push(HX_("zpp_inner_zn",22,84,fa,e0));
  	outFields->push(HX_("body1",4f,d3,ef,b6));
  	outFields->push(HX_("body2",50,d3,ef,b6));
  	outFields->push(HX_("ratio",0b,35,24,e4));
  	outFields->push(HX_("rate",e0,52,a4,4b));
  	super::__GetFields(outFields);
  };
  
  #ifdef HXCPP_SCRIPTABLE
  static hx::StorageInfo MotorJoint_obj_sMemberStorageInfo[] = {
  	{hx::fsObject /*  ::zpp_nape::constraint::ZPP_MotorJoint */ ,(int)offsetof(MotorJoint_obj,zpp_inner_zn),HX_("zpp_inner_zn",22,84,fa,e0)},
  	{ hx::fsUnknown, 0, null()}
  };
  static hx::StaticInfo *MotorJoint_obj_sStaticStorageInfo = 0;
  #endif
  
  static ::String MotorJoint_obj_sMemberFields[] = {
  	HX_("zpp_inner_zn",22,84,fa,e0),
  	HX_("get_body1",a6,2f,99,fa),
  	HX_("set_body1",b2,1b,ea,dd),
  	HX_("get_body2",a7,2f,99,fa),
  	HX_("set_body2",b3,1b,ea,dd),
  	HX_("get_ratio",62,91,cd,27),
  	HX_("set_ratio",6e,7d,1e,0b),
  	HX_("get_rate",69,0e,5f,cb),
  	HX_("set_rate",dd,67,bc,79),
  	HX_("impulse",b5,50,bd,6d),
  	HX_("bodyImpulse",33,76,a2,5f),
  	HX_("visitBodies",ab,f3,5e,e4),
  	::String(null()) };
  
  hx::Class MotorJoint_obj::__mClass;
  
  void MotorJoint_obj::__register()
  {
  	MotorJoint_obj _hx_dummy;
  	MotorJoint_obj::_hx_vtable = *(void **)&_hx_dummy;
  	hx::Static(__mClass) = new hx::Class_obj();
  	__mClass->mName = HX_("nape.constraint.MotorJoint",20,6d,45,bc);
  	__mClass->mSuper = &super::__SGetClass();
  	__mClass->mConstructEmpty = &__CreateEmpty;
  	__mClass->mConstructArgs = &__Create;
  	__mClass->mGetStaticField = &hx::Class_obj::GetNoStaticField;
  	__mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField;
  	__mClass->mStatics = hx::Class_obj::dupFunctions(0 /* sStaticFields */);
  	__mClass->mMembers = hx::Class_obj::dupFunctions(MotorJoint_obj_sMemberFields);
  	__mClass->mCanCast = hx::TCanCast< MotorJoint_obj >;
  #ifdef HXCPP_SCRIPTABLE
  	__mClass->mMemberStorageInfo = MotorJoint_obj_sMemberStorageInfo;
  #endif
  #ifdef HXCPP_SCRIPTABLE
  	__mClass->mStaticStorageInfo = MotorJoint_obj_sStaticStorageInfo;
  #endif
  	hx::_hx_RegisterClass(__mClass->mName, __mClass);
  }
  
  } // end namespace nape
  } // end namespace constraint
  