norbert Posted June 19, 2011 Share Posted June 19, 2011 Hi, in the lua Script file driver.lua there load the Model and read from the Objecttable: chassis=LoadModel("abstract::vehicle_viperscout.gmf") carobject=objecttable[chassis] car=carobject.vehicle Ok, but how can I use this in BlitzMax? I load my car: Global chassis:TModel chassis = LoadModel ("abstract::vehicle_viperscout.gmf") How can I use the objecttable[chassis] in Blitzmax ? Norbert Quote Link to comment Share on other sites More sharing options...
norbert Posted June 20, 2011 Author Share Posted June 20, 2011 There is no way to AddTorque of an lua script modell in Blitzmax ? Quote Link to comment Share on other sites More sharing options...
Flexman Posted June 21, 2011 Share Posted June 21, 2011 You're wanting to access a LUA object from you main program code? Off the top of my head... And in BMax before you load your scene, make an object and assign a name as a reference you can access in your script... Local tempObject:Object; SetGlobalObject("car_chassis", tempObject ) ; ' LOAD A SCENE ' ' Cast tempObject to whatever you need ' Local carmodel:TModel = TModel(tempObject); In the LUA script set the object pointer to the name ... SetGlobalObject( "car_chassis", chassis ) There's some older threads on this, search on "SetScriptObject" and "SetGlobalObject" Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
norbert Posted June 23, 2011 Author Share Posted June 23, 2011 Thank you but somehow does not work. OK. In Detail. When I start the Editior and use the driver.lua then I can drive in the Editor with the viperscout. In this Script file "driver.lua" there load the Model and read from the objecttable: chassis=LoadModel("abstract::vehicle_viperscout.gmf") carobject=objecttable[chassis] car=carobject.vehicle Later in the script there add Torque to the tire: car:AddTireTorque(tirespeed,0) In BlitzMax I load the Model same way as in lua script file: Global chassis:TModel chassis = LoadModel ("abstract::vehicle_viperscout.gmf") In Blitzmax I must AddTireTorque( tire:TTire, torque:Float ) but I have no tires only a TModel. Ok how can I AddTireTorque to this Model in Blitzmax ? Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 23, 2011 Share Posted June 23, 2011 in bmax i believe the command is CreateTire() CreateTire:TTire( body:TBody, pos:TVec3, pin:TVec3, radius:Float suspensionLength:Float = 0.0, springConstant:Float = 0.0, springDamping:Float = 0.0 ) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
norbert Posted June 23, 2011 Author Share Posted June 23, 2011 Yes, thats right, but I load the Model and the lua script from the car load automatic with tires and Physik. The car is ready for driving. I need a Command to manipulate or transfer my TireSpeed in the Script file from the car. Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 24, 2011 Share Posted June 24, 2011 oh.. gotcha... guess i should read the whole post first... well, just do as Flexman stated and set the tires as GlobalObjects in lua then use GetGlobalObject() in bmax to access the tires, then you should be able to add torque... assuming that you cannot access the tires from the chassis in bmax if you make it a global object. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
norbert Posted June 24, 2011 Author Share Posted June 24, 2011 Ok, thank you but the is a error: Unable to convert from leadwerks.engine.TTire to TVehicle What have I do: In the viperscout.lua file i have add the SetGlobalObject command: pivot=object.model:FindChild("tire1") if pivot~=nil then tireradius=pivot.aabb.h/2.0 object.vehicle:AddTire(TFormPoint(pivot.position,pivot.parent,model),tireradius,suspensionlength,springconstant,springdamper) object.tire[0]=LoadMesh("abstract::vehicle_viperscout_tire_left.gmf",model) SetGlobalObject( "car_tire1", object.tire[0]) pivot:Hide() end In BMax first (before Load the Scene): Global temp_tire1_Object:Object SetGlobalObject("car_tire1", temp_tire1_Object) Second after loading the viperscout.gmf (TModel) after load the scene: Global car_Tire1:TTire = TTire(temp_tire1_Object) and in the mainloop addTorque: tirespeed# = -(KeyDown(KEY_W)-KeyDown(KEY_S))*5 AddTireTorque( car_Tire1, tirespeed# ) and I get the Error Message. Quote Link to comment Share on other sites More sharing options...
norbert Posted June 27, 2011 Author Share Posted June 27, 2011 Nobody an Idea ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.