VeTaL Posted March 24, 2010 Share Posted March 24, 2010 Okay, i have a building model and some detail models like stones, so the building is main models and stones are detail models. First, i want those stones to be ignored by Newton, so i wanted to add some LUA scripting: "house" is created in editor, then its form is calculated as Convex Hull, and then artist can add stones as he want, but they would be ignored by physic. (right picture) What is the best solution for this? Second, can i be sure that all that same models (buildings are the same model, all bricks are also the same models) are rendered using instancing? (left picture) Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted March 24, 2010 Author Share Posted March 24, 2010 Third: when i clicked on building class (as its written in Getting_Started_With_Lua.pdf) and paste here require("Scripts/class") local class=CreateClass(...) function class:InitDialog(propertygrid) local group=propertygrid:AddGroup("MyGroup") group:AddProperty("MyValue",PROPERTY_STRING) end and run it, i got a crash "table index is nil" in class.lua, in string "classtable[modelreference]=class" Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted March 24, 2010 Author Share Posted March 24, 2010 Also, there is no collisions between player and buildings (but there is collisions between player and terrain), even with Collisions(1,1,1); EntityType(player.GetPlayerBody(), 1); EntityType(scene.GetScene(), 1); Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted March 24, 2010 Share Posted March 24, 2010 Third: when i clicked on building class (as its written in Getting_Started_With_Lua.pdf) and paste here require("Scripts/class") local class=CreateClass(...) function class:InitDialog(propertygrid) local group=propertygrid:AddGroup("MyGroup") group:AddProperty("MyValue",PROPERTY_STRING) end and run it, i got a crash "table index is nil" in class.lua, in string "classtable[modelreference]=class" Because you don't run it. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 24, 2010 Share Posted March 24, 2010 like Marleys Ghost is saying: Don't run your class script! just save it. Only a game sript (like fpscontroller.lua) can be run. If your model doesn't have a phy file, then the editor automaticly creates one for you when you drag the object into your scene. I would build the main model in your 3d program and give it a convex hull physics shape. Then i would export the stones sepperatly and make no physics file for them. Then with code you can attach the stones to your model: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) --load the stones self.stones=LoadModel ("abstract::stones.gmf") --position stones or use the offset by exporting self.stones:SetPosition(Vec3(-2.3,2.41,-1.79)) --parent stones to the main model self.stones:SetParent (object.model) --done with parenting function object:Free(model) self.super:Free() end end instead of getplayerbody. U can perhaps just use : player. remember to set it to a global object. Setglobalobject("playercontroller",player) Quote Link to comment Share on other sites More sharing options...
VeTaL Posted March 24, 2010 Author Share Posted March 24, 2010 Thanks, guys, maybe i'll make my first "user's contribution" with this theme. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted March 25, 2010 Author Share Posted March 25, 2010 Emm.. I added to LUA require("scripts/class") local class=CreateClass(...) function class:InitDialog(propertygrid) self.super:InitDialog(propertygrid) local group=propertygrid:AddGroup("Stones") group:AddProperty("StoneNumber", PROPERTY_INTEGER ) group:AddProperty("StonePosition", PROPERTY_VEC3 ) end function class:CreateObject(model) local object=self.super:CreateObject(model) --load the stones self.stones=LoadModel ("abstract::Dec01.gmf") --position stones or use the offset by exporting self.stones:SetPosition(Vec3(-4,6,-0.7)) --parent stones to the main model self.stones:SetParent (object.model) --done with parenting function object:Free(model) self.super:Free() end end but still have physic on stones 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.