Jump to content

Scene managment again


VeTaL
 Share

Recommended Posts

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)

post-648-12694316015675_thumb.jpg

post-648-12694316112005_thumb.jpg

Working on LeaFAQ :)

Link to comment
Share on other sites

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"

Working on LeaFAQ :)

Link to comment
Share on other sites

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.

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

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)

Link to comment
Share on other sites

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

post-648-12694754707681_thumb.jpg

Working on LeaFAQ :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...