i cant really see anything wrong with the code. try asking at the newton forums

http://www.newtongamedynamics.com