-- LUA Script - precede every function and global member with lowercase name of script + '_main' local wheels = {} function physics_demo_wheel_init_name( e, name ) wheels[ e ] = { state = 'init', name = name } end g_body_object = g_bofy_object or 0 function physics_demo_wheel_main( e ) local wheel = wheels[ e ] if wheel == nil or org_body_object == 0 then return end if wheel.state == 'init' then local whObj = g_Entity[ e ].obj local constraint = nil if wheel.name == 'frontR' then constraint = CreateDoubleHinge( g_body_object, whObj, 26, -18, 35, 0, 0, 0, 1, 2, 1 ) elseif wheel.name == 'frontL' then constraint = CreateDoubleHinge( g_body_object, whObj,-26, -18, 35, 0, 0, 0, 1, 2, 1 ) elseif wheel.name == 'rearR' then constraint = CreateDoubleHinge( g_body_object, whObj, 26, -18, -35, 0, 0, 0, 1, 2, 1 ) elseif wheel.name == 'rearL' then constraint = CreateDoubleHinge( g_body_object, whObj,-26, -18, -35, 0, 0, 0, 1, 2, 1 ) end if constraint ~= nil then wheel.state = 'done' end end end