Alessandro Posted September 12, 2010 Share Posted September 12, 2010 Hello, I need to create slider joint to make a suspension, but I get always an errore from LE. This is the code: local myWheelFL = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model) local myWheelFR = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model) local myWheelRL = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model) local myWheelRR = LoadModel("abstract::" .. "vehicle_proto_wheel.gmf", object.model) if myWheelFL == nil then Notify("Errore creazione wheel") return end myWheelFL:SetPosition(Vec3(-1.6, -0.8, -2)) myWheelFR:SetPosition(Vec3(-1.6, -0.8, 2)) myWheelRL:SetPosition(Vec3(1.6, -0.8, -2)) myWheelRR:SetPosition(Vec3(1.6, -0.8, 2)) -- ******* THIS FUNCTION CALL GIVE ME THE ERROR *********** object.model:CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0)) I get "Index for object is not a valid field or method". If instead I use object.model:CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0)) I get: Attempt to call method (a nil value). But I'm sure the object pointers and the wheels are created (I check them). Please help me! Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 12, 2010 Share Posted September 12, 2010 Its because CreateJointSlider is not a method of object.model. It should be something like this (assuming the rest of your parameters are filled out correctly): object.joint = CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 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...
AggrorJorn Posted September 12, 2010 Share Posted September 12, 2010 What should this line be doing? "abstract::" .. "vehicle_proto_wheel.gmf" Shouldn't it just be: "abstract::vehicle_proto_wheel.gmf" Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 12, 2010 Share Posted September 12, 2010 What should this line be doing? "abstract::" .. "vehicle_proto_wheel.gmf" Shouldn't it just be: "abstract::vehicle_proto_wheel.gmf" as far as LoadModel() is concerned it doesn't make a difference since lua just adds the two strings together... 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...
Alessandro Posted September 12, 2010 Author Share Posted September 12, 2010 What should this line be doing? "abstract::" .. "vehicle_proto_wheel.gmf" Shouldn't it just be: "abstract::vehicle_proto_wheel.gmf" Yes, you are right, it was in the first form since the wheel name will be stored in a variable: "abstract::" .. locWheelName @macklebee, thank you for your help. Even if LUA seems a very important piece inside LE, its documentation is not enough, and not clear. I wish a better documentation for the future. Thank you again! Quote Link to comment Share on other sites More sharing options...
Alessandro Posted September 12, 2010 Author Share Posted September 12, 2010 object.joint = CreateJointSlider(myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0)) The exact syntax (from documentation) is: object.joint = CreateJointSlider(object.model, myWheelFL, Vec3(-1.6, -0.8, 2), Vec3(-1.6, 0, 0)) In fact you forgot the parent object Cheers! (thank you again!) Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 12, 2010 Share Posted September 12, 2010 no didnt forget it... just didnt take the time to fix your code as listed from above just to show that the CreateJointSlider() command was not a method of object.model... 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...
Alessandro Posted September 12, 2010 Author Share Posted September 12, 2010 Ok, setting a Newton vehicle in LE is a mess. Too many information are missing! Pleae Josh give me some hints how to proceed or I will push myself under a real car Now I have this code (not work): function class:CreateObject(argModel) local object=self.super:CreateObject(argModel) local myWheelFL = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model) local myWheelFR = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model) local myWheelRL = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model) local myWheelRR = LoadModel("abstract::" .. "vehicleProtoWheel.gmf", object.model) if myWheelFL == nil then Notify("Errore creazione myWheelFL") return end if myWheelFR == nil then Notify("Errore creazione myWheelFR") return end if myWheelRL == nil then Notify("Errore creazione myWheelRL") return end if myWheelRR == nil then Notify("Errore creazione myWheelRR") return end --local locFL = TFormPoint(Vec3(-1.6, -0.8, -2) , object.model, nil) local locFL = Vec3(-1.6, -0.8, -2) myWheelFL:SetPosition(locFL) --local locFR = TFormPoint(Vec3(-1.6, -0.8, 2) , object.model, nil) local locFR = Vec3(-1.6, -0.8, 2) myWheelFR:SetPosition(locFR) --local locRL = TFormPoint(Vec3(1.6, -0.8, -2) , object.model, nil) local locRL = Vec3(1.6, -0.8, -2) myWheelRL:SetPosition(locRL) --local locRR = TFormPoint(Vec3(1.6, -0.8, 2) , object.model, nil) local locRR = Vec3(1.6, -0.8, 2) myWheelRR:SetPosition(locRR) local myWheelRLJoint = CreateJointSlider(object.model, myWheelRL, locRL, Vec3(locRL.x, locRL.y+0.2, locRL.z)) local myWheelFLJoint = CreateJointSlider(object.model, myWheelFL, locFL, Vec3(locFL.x, locFL.y+0.2, locFL.z)) local myWheelRRJoint = CreateJointSlider(object.model, myWheelRR, locRR, Vec3(locRR.x, locRR.y+0.2, locRR.z)) local myWheelFRJoint = CreateJointSlider(object.model, myWheelFR, locFR, Vec3(locFR.x, locFR.y+0.2, locFR.z)) --[[********************************************************************************************** **********************************************************************************************]]-- function object:Free() --[[----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------]]-- if myWheelFLJoint ~= nil then FreeJoint(myWheelFLJoint) myWheelFLJoint = nil end if myWheelFRJoint ~= nil then FreeJoint(myWheelFRJoint) myWheelFRJoint = nil end if myWheelRLJoint ~= nil then FreeJoint(myWheelRLJoint) myWheelRLJoint = nil end if myWheelRRJoint ~= nil then FreeJoint(myWheelRRJoint) myWheelRRJoint = nil end --[[----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------]]-- if myWheelFL ~= nil then myWheelFL:Free() myWheelFL = nil end if myWheelFR ~= nil then myWheelFR:Free() myWheelFR = nil end if myWheelRL ~= nil then myWheelRL:Free() myWheelRL = nil end if myWheelRR ~= nil then myWheelRR:Free() myWheelRR = nil end self.super:Free()--Don't forget this!! end end function object:Update() --self.model:Turn(Vec3(GetEntityKey(self.model, "Rotate X"), -1 * tonumber(GetEntityKey(self.model, "Rotate Y", 0)), GetEntityKey(self.model, "Rotate Z"))) end end JOints not work, and I cannot understand how to manage them. I stored tires as separated models, and I create them as child of the chassis. Not work. And this is a screenshot: http://www.mediafire.com/?h87o7eb7z5ukb PLEASE!! I need a real vehicle model! PLEASE JOSH! Quote Link to comment Share on other sites More sharing options...
Alessandro Posted September 13, 2010 Author Share Posted September 13, 2010 No help from anyone? Please give me a hint how to proceed! I need to make a real vehicle! Vehicle built-in LE is fine, but too "arcade-style". Anyone? Thank you! Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 13, 2010 Share Posted September 13, 2010 Have you tried using the Create vehicle command? I agree with the documentation on joints. It is not sufficient for most people to make something work with it. Did you have a look at the driver scripts and viper scout script? Quote Link to comment Share on other sites More sharing options...
Alessandro Posted September 13, 2010 Author Share Posted September 13, 2010 Have you tried using the Create vehicle command? I agree with the documentation on joints. It is not sufficient for most people to make something work with it. Did you have a look at the driver scripts and viper scout script? Of course, I successfully used them. But that is a partially simulated vehicle (it uses raycast and anims to simulate tires and car movement). I need a realistic car feedback Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 13, 2010 Share Posted September 13, 2010 Of course, I successfully used them. But that is a partially simulated vehicle (it uses raycast and anims to simulate tires and car movement). I need a realistic car feedback anims as in animations? 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...
Alessandro Posted September 13, 2010 Author Share Posted September 13, 2010 anims as in animations? yes. Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 13, 2010 Share Posted September 13, 2010 odd... I dont remember any animations in the cars I have tried... 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...
Alessandro Posted September 13, 2010 Author Share Posted September 13, 2010 odd... I dont remember any animations in the cars I have tried... The animations are the ones used to simulate wheel movement (up/down) for suspensions. Quote Link to comment Share on other sites More sharing options...
VeTaL Posted September 14, 2010 Share Posted September 14, 2010 //The animations are the ones used to simulate wheel movement (up/down) for suspensions. And wheels rotation Well, i'm also interested in car with physic wheels, not raycast. Looking like we need to dig into Newtons header and get physic car functions from there. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Alessandro Posted September 14, 2010 Author Share Posted September 14, 2010 //The animations are the ones used to simulate wheel movement (up/down) for suspensions. And wheels rotation Well, i'm also interested in car with physic wheels, not raycast. Looking like we need to dig into Newtons header and get physic car functions from there. I tried to get some newton programs made in other languages, but it is not easy to convert them in LE style, since Newton implement a simplifed version of the vehicle using special API, and those api are not implementd in LE. I cannot find clear information how to create a real vehicle even in newton self. If you can find a source code in any language showing how to create a real vehicle, please send me that, and I will try to convert it in LE (LUA). Then I will send you the converted code Quote Link to comment Share on other sites More sharing options...
VeTaL Posted September 14, 2010 Share Posted September 14, 2010 There must be an example in Newton sources, i tried to convert it some years ago, to 3dgamestudio, that was really hell. i'll look into it. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted September 14, 2010 Share Posted September 14, 2010 Hm, looking like development of vechicle is abaddoned. I'll search for old examples, but i'm not sure that they will work with current version of Newton.dll, but we can try Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted September 14, 2010 Share Posted September 14, 2010 http://newtondynamics.com/forum/viewtopic.php?f=11&t=5722 http://newtondynamics.com/wiki/index.php5?title=API_Database#Vehicle_Joint_functions but they all are " This function is deprecated in newton 2" But, http://newtondynamics.com/forum/viewtopic.php?f=9&t=5638 Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted September 14, 2010 Share Posted September 14, 2010 Here you are... This is the only thing i found in 2.24 about MultibodyVechicle. dCustomJoints.rar Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Alessandro Posted September 14, 2010 Author Share Posted September 14, 2010 http://newtondynamics.com/forum/viewtopic.php?f=11&t=5722 http://newtondynamics.com/wiki/index.php5?title=API_Database#Vehicle_Joint_functions but they all are " This function is deprecated in newton 2" But, http://newtondynamics.com/forum/viewtopic.php?f=9&t=5638 Thank you, I will check them. I own 3dgs also, and I tried to follow the new vehicle system they use, but is difficult since they use PhysX engine, and API (and their usage) are really different (and I abandonded the conversion). I will check your links (maybe we can extract something good :-) EDIT: A couple of links have the same problem I already found in the past: they refere to a specifi object class existing in Newton engine. This class is specialized to make vehicles. As per my knowledge, we haven' that class in LE, so we need to create a vehicle from scratch (using basic joints). Thank you! Quote Link to comment Share on other sites More sharing options...
VeTaL Posted September 14, 2010 Share Posted September 14, 2010 Yep, also somewhere in 2.0 version there were working physic car example, but i worked on it too many time ago, so i dont remember, where exactly. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted September 19, 2010 Share Posted September 19, 2010 http://forum.leadwerks.com/viewtopic.php?f=2&t=3761&p=33322&hilit=vehicle#p33322 Hope, this would help you Quote Working on LeaFAQ 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.