Joe Posted July 18, 2014 Share Posted July 18, 2014 I am working on an imported fbx model and i want to adjust the physical appearance in real time, but the functions for setting vertex positions do not have any visible effect on the model. Is this code wrong or is it not implemented in lua or what? thanks for your interest local v = vertex self.hits = self.hits + 1 local sfc = self.entity:GetSurface(0) local vp = sfc:GetVertexPosition(v) local vn = vp:Normalize() * 0.5 local offset = vp + (Vec3(0) - vn) sfc:SetVertexPosition(v,offset) self.entity:UpdateAABB(self.entity.LocalAABB) self.entity:UpdateAABB(self.entity.GlobalAABB) self.entity:UpdateAABB(self.entity.RecursiveAABB) System:Print(vp) System:Print(offset) Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 18, 2014 Share Posted July 18, 2014 The example code located here works just fine and as a test I tried it on a model and it worked as well. You are not updating the surface AABB, normals, binormals, and tangents. sfc:Update() Other than that I would just suggest you 'System:Print' each value to make sure the values are what you expect. also on a side note, the forum allows you to put code into code tags which makes reading code easier on old guys like myself. Look for the '<>' icon on the toolbar. --Edit you need to update several things - which is covered by Surface:Update() instead of just surface:UpdateAABB() 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...
Joe Posted July 18, 2014 Author Share Posted July 18, 2014 thanks macklebee i thought it was something like that 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.