Jump to content

SetVertexPosition not registering


Joe
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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()

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

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...