wayneg Posted September 8, 2011 Share Posted September 8, 2011 I can turn the mesh using the first findchild, but not the blades, what am I doing wrong? require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group=grid:AddGroup("Model") group:AddProperty("Scale",PROPERTY_VEC3,"","Scale") group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) local mesh1=CreateCube() object.mesh=model:FindChild("U3D_STATIC_MESH") object.blades=model:FindChild("blades") object.scale=Vec3(0.05,0.05,0.05) object.model:SetKey("scale","0.05,0.05,0.05") function object:Update() if object.blades~=nil then object.blades:Turn(Vec3(0,1,0)) mesh1:Turn(Vec3(0,1,0)) end end function object:SetKey(key,value) if key=="scale" then self.scale=StringToVec3(value) object.model:SetScale(StringToVec3(value)) else return self.super:SetKey(key,value) end --return 1 end function object:GetKey(key,value) if key=="scale" then return self.scale.x..","..self.scale.y..","..self.scale.z else return self.super:GetKey(key,value) end return value end function object:Refresh() object.model:SetScale(StringToVec3(self.model:GetKey("scale"))) end function object:RestoreDefaults() end function object:Free(model) self.super:Free() mesh1:Free() end object:Refresh() end Quote Link to comment Share on other sites More sharing options...
Canardia Posted September 8, 2011 Share Posted September 8, 2011 Make some checks if it finds the windmill mesh and its blades bone/submesh. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
macklebee Posted September 8, 2011 Share Posted September 8, 2011 is this the old windmill by wailingmonkey from the early 2.3 days? If so, then the lua script should be for the windmill gmf and the findchild name for the blades is "windmill_blades". If it is some other model, then without seeing the model i can only guess that you do not have the right name for the submesh. and fyi, the '<>' icon in the reply toolbar is for code... just place your code in between... 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...
wayneg Posted September 8, 2011 Author Share Posted September 8, 2011 is this the old windmill by wailingmonkey from the early 2.3 days? If so, then the lua script should be for the windmill gmf and the findchild name for the blades is "windmill_blades". If it is some other model, then without seeing the model i can only guess that you do not have the right name for the submesh. and fyi, the '<>' icon in the reply toolbar is for code... just place your code in between... I downloaded the windmill off google into sketchup and then setup a group to include the blades and bearings. I saved to skp, and then loaded UU3D and changed the bone name to 'blades' and saved to GMF. I confirmed the bone name with leadwerks model viewer. I probably should of posted the windmill model, so I'll do that later today. Thanks for quick reply Quote Link to comment Share on other sites More sharing options...
wayneg Posted September 8, 2011 Author Share Posted September 8, 2011 Make some checks if it finds the windmill mesh and its blades bone/submesh. if object.blades~=nil then Do you mean I should do something other than this ? Quote Link to comment Share on other sites More sharing options...
Canardia Posted September 8, 2011 Share Posted September 8, 2011 I mean like make some Print or Notify so that you can see if it actually finds the objects. Like Notify("Blades not found!"). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
wayneg Posted September 8, 2011 Author Share Posted September 8, 2011 I mean like make some Print or Notify so that you can see if it actually finds the objects. Like Notify("Blades not found!"). That was the purpose of the cube, but yeah, I can add that check at the top. I must confess I added a notify to the update section and that was a really bad idea since it notified me every frame!! doh! lo l Quote Link to comment Share on other sites More sharing options...
wayneg Posted September 9, 2011 Author Share Posted September 9, 2011 Thank you Macklebee for pointing out UU3D limitations when exporting GMF, because that has lead to a solution !! Testing new submeshes and goodies coming out of Sketchup, Deled, Hexagon... The 3D warehouse is mine now! Quote Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted September 9, 2011 Share Posted September 9, 2011 hey... the ole squeaky windmill... yeah, i remember that... spent a lot of time around that thing... i also played around with spinning the blades (in Blitzmax code)... like Mac said above, findchild will do it... ' find the windmill blades... only they will spin, not the entire object ' Local theBlades:TEntity=FindChild(Self.mesh,"windmill_blades") --Mike 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.