flachdrache Posted August 16, 2010 Share Posted August 16, 2010 Hi, i have some single objects i like to load into a lua class to assemble level geometry. The hope here is to let OcclusionCulling remove child parts of the assembled parent (?!) and to be able to "fade out" parts of it by camera distance (top-down or iso-camera). The single objects do have an offset relative to each other, so itll fit well together. As far as i understand, i do need to write an update function to roatate/position the model in one piece (using a dummy model as parent). That works quit well - The issue now is (with my current code) that the loadModel does load the correct phy objects, though - but the physic keys, i set on the parent (dummy) model, aint passed to the child object(s). function class:CreateObject(model) local object=self.super:CreateObject(model) --Load all the parts for the models object.large02_quad_high_base=LoadModel("abstract::gTown_AddOn_FlatGreen_large02_quad_high_base.gmf") object.large02_quad_high_green=LoadModel("abstract::gTown_AddOn_FlatGreen_large02_quad_high_green.gmf") --parent all parts to form the model object.large02_quad_high_base:SetParent(object.model) object.large02_quad_high_green:SetParent(object.model) --object handling will now be performed relative to its parent object.large02_quad_high_base:SetPosition(object.model.position, 1) object.large02_quad_high_base:SetRotation(object.model.position, 1) object.large02_quad_high_green:SetPosition(object.model.position, 1) object.large02_quad_high_green:SetRotation(object.model.position, 1) --[[ function object:Collision(entity,position,normal,force,speed) end ]]-- function object:Update() object.large02_quad_high_base:SetPosition(object.model:GetPosition(0), 1) object.large02_quad_high_base:SetRotation(object.model:GetPosition(0), 1) object.large02_quad_high_green:SetPosition(object.model:GetPosition(0), 1) object.large02_quad_high_green:SetRotation(object.model:GetPosition(0), 1) end function object:Free(model) self.super:Free() end end How do i get physics interaction on the child models ? Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
flachdrache Posted August 17, 2010 Author Share Posted August 17, 2010 Ermmmm - ok, since this will allways be scene collision i added object.large01_quad_high_base :SetCollisionType( COLLISION_SCENE, 0 ) object.large01_quad_high_green:SetCollisionType( COLLISION_SCENE, 0 ) and it seams the loaded phy will indeed be used. However, any takers on the OcclusionCulling part i.e. will the ground level apartment be occluded if the player is on second floor ? Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 17, 2010 Share Posted August 17, 2010 Your child models can have lua files as wel. If you add SetCollisionType( COLLISION_SCENE, 0 ) in their Lua files you can have collision in the childs. Quote Link to comment Share on other sites More sharing options...
flachdrache Posted August 17, 2010 Author Share Posted August 17, 2010 Hmmm, thanks for the head up but the child models are actually not needed since i load them into a "dummy" model (the parent). However, i guess i cant exclude them from the list of available models. I would like to pass "COLLISION_PROP" to the child models, so i can let a small house float in a river but using a pivot might be better anyway. I tried "CopyEntityKeys" and such but w/o effect - changing color, hide/unhide gets translated to the child(s), however. I guess ill go through your how-to`s and read a little more and see what i can gather, Aggror. Quote AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3 zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5 Xxploration FPS in progress ... 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.