Jump to content

Joe

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Joe

  1. I have a script which adds blocks to order to make a level, but it won't supply a working Navmesh. I have reworked it to the script on the website, but DebugNavigatioMode shows no blue area. This is the script for each box width = 2.56 height = 1.28 depth = 2,56 local sc = Vec3(width,height,depth) local m = Model:Box() local s = Shape:Box() m:SetShape(s) s:Release() m:SetScale(sc) m:SetNavigationMode(true) Shouldn't this, when using world:BuildNavmesh, be enough to create a navmesh in game? Each side is only 2.56 long so it is not the edge length. Characters also have navigation mode enabled but there is no blue area even. Edit - It works on a test box, nut not on the script I have written that creates multiple boxes and then builds the navmesh. I will keep working on it but if anyone has any tip on building navmeshes from script it would be much appreciated Solved - the objects parents were not set to navigation mode, so the hierarchy was upset
  2. I have this model but the mesh doesn't attach to the armature, can anyone explain this for me? it is a blender model with the new importer used but the preview doesn't give action for the mesh
  3. thanks macklebee i thought it was something like that
  4. 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)
  5. there are no triangles on the internal model either in the global pickinfo, although when i counttriangles there are 480
  6. I have tried that now but it has no triangle at all now. I will look in to it. Edit Is it possible to find a triangle on a pick entity that is imported? the triangles might not register in the same way, as when i made the pickinfo global and tried the impact on two places the triangle variable stayed at 0. I will try it on a internal model
  7. its come up -1, you are right. Is it normally a simple process with a Pick triangle? It should come back with the triangle integer according to the PickInfo section. this is the pick script w:Pick(b,b + d,pk,3,true) if pk.entity ~= nil then local v = pk.entity:GetKeyValue("mining","") if v == "true" then pk.entity.script.hitmark = pk.triangle pk.entity.script.srfc = pk.surface pk.entity.script.hitnorm = pk.normal System:Print(pk.entity.script.hitmark) end local v = pk.entity:GetKeyValue("hit","") if v == "false" then pk.entity:SetKeyValue("hit","true") end would it be more than one with that radius? - edit end
  8. here is the code for i = 0,2 do local v = self.srfc:GetTriangleVertex(self.hitmark,i) local vp = self.srfc:GetVertexPosition(v) local p = self.entity:GetPosition(true) System:Print(vp) System:Print(p) end it is the link in the index under Surface that has the reference to GetTriangleCorner on the website, at least for me. its not on any other part of the website, and it doesn't highlight, but still this should have returned a triangle not nil method self.hitmark refers to a Pick Triangle
  9. I have an error message stating GetTriangleVertex is a nil value. does anyone know what that means? It is listed as GetTriangleCorner or GetTriangleVertex under Surface in the documentation but neither seem to work I have created a "nearest Vertex" Script, based on GetEntityNeighbours.It returns the vector nearest the position stated. Here it is It will be slow with high numbers of vertices GetVertexCallbackTable = nil function WorldGetVertexInAABBDoCallback(entity,extra) local k = entity:GetKeyValue("mining","") local p = entity:GetPosition(true) if k == "true" then local d = {} local v = 1000 local a = 0 local b = 0 local sfc = entity:GetSurface(0) for i = 0,sfc:CountVertices()-1 do local u = sfc:GetVertexPosition(i) local pos = extra - p d[i] = pos:DistanceToPoint(u) end for i = 0,sfc:CountVertices()-1 do for u = sfc:CountVertices()-1,0,-1 do if d[i] <= d[u] then if v > d[i] then a = i v = d[i] end end end end table.insert(GetVertexCallbackTable,a) end end function GetVertex(entity,position) local result local aabb = AABB() local p = entity:GetPosition(true) aabb.min = p - 5 aabb.max = p + 5 aabb:Update() local table = GetVertexCallbackTable GetVertexCallbackTable = {} entity.world:ForEachEntityInAABBDo(aabb,"WorldGetVertexInAABBDoCallback",position) result = GetVertexCallbackTable GetVertexCallbackTable = table return result end
  10. Joe

    emitter failure

    it was SetDuration, not in milliseconds
  11. I have this emitter giving a pulse at a normalised vector of itself but it won't fire. can anyone give me advice on what is wrong with this script? Thank you local n = b:Normalize() * 4 local ect,e if e == nil then ect = 10 e = Emitter:Create(5) e:SetPosition(n,true) e:SetInterval(1) e:SetDuration(5) e:SetEmissionShape(1) e:SetEmissionVolume(0, 0, 0) e:ClearAlphaControlPoints() e:ClearScaleControlPoints() e:AddScaleControlPoint(0, 4) e:AddScaleControlPoint(1, 6) e:SetParticleColor(0.1, 0, 0, 1, 0) e:SetParticleColor(0.95, 0, 0, 1, 1) e:SetVelocity(0, 0, 0, 0) --e:SetVelocity(n.x, n.y, n.z, 0) e:SetVelocity(0, 0, 0, 1) e:SetAcceleration(n.x,n.y,n.z) e:SetLoopMode(false) end if e ~= nil then ect = ect - 1 if ect == 0 then e:Release() end
×
×
  • Create New...