Jump to content

shadmar

Members
  • Posts

    3,618
  • Joined

  • Last visited

Posts posted by shadmar

  1. If you got 3 points, just use a spline.

     

    Example :

     

    function smooth( points, steps )
       if #points < 3 then
           return points
       end
    
       local steps = steps or 500
    
       local spline = {}
       local count = #points - 1
       local p0, p1, p2, p3, x, y, h
    
       for i = 1, count do
    
           if i == 1 then
               p0, p1, p2, p3 = points[i], points[i], points[i + 1], points[i + 2]
           elseif i == count then
               p0, p1, p2, p3 = points[#points - 2], points[#points - 1], points[#points], points[#points]
           else
               p0, p1, p2, p3 = points[i - 1], points[i], points[i + 1], points[i + 2]
           end    
    
           for t = 0, 1, 1 / steps do
               x = 0.5 * ( ( 2 * p1.x ) + ( p2.x - p0.x ) * t + ( 2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x ) * t * t + ( 3 * p1.x - p0.x - 3 * p2.x + p3.x ) * t * t * t )
               y = 0.5 * ( ( 2 * p1.y ) + ( p2.y - p0.y ) * t + ( 2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y ) * t * t + ( 3 * p1.y - p0.y - 3 * p2.y + p3.y ) * t * t * t )
               h = 0.5 * ( ( 2 * p1.h ) + ( p2.h - p0.h ) * t + ( 2 * p0.h - 5 * p1.h + 4 * p2.h - p3.h ) * t * t + ( 3 * p1.h - p0.h - 3 * p2.h + p3.h ) * t * t * t )
    
               --prevent duplicate entries
               if not(#spline > 0 and spline[#spline].x == x and spline[#spline].y == y) then
                   table.insert( spline , { x = x , y = y, h = h } )                
               end    
           end
    
       end    
       return spline
    end

     

    Visual example, by drawing 20 boxes aling the spline of 3 points

     

       points = { }
       table.insert( points, { x=-5,y=28, h=17 })  -- start
       table.insert( points, { x=-5,y=38, h=39 })  -- top
       table.insert( points, { x=-5,y=48, h=17 })  -- end
    
       --make spline of points, 20 iterations
       local arc=smooth( points,20)
    
       --visualize arc
       for k,v in pairs( arc )
       do
           Model:Box():SetPosition(v.x,v.h,v.y)
       end
    

    • Upvote 4
  2. Nice game. Well done!

     

    One question, why the forced windowed mode? If you leave the main.lua defaults it will use your settings on the gameplayer instead smile.png

    • Upvote 1
  3. You dont really need a special shader, just do as drarem says and change to a material wich has no depth test and some emission when there is no rayhit, swicth back when camera ray hits.

    That is what is done in that old video Thirsty Phanter linked.

     

    Macklebee has an more advanced shader, but it's advanced stuff to set up, so I'd go with the raycast method.

  4. Just keep the thermal fans/radiators clean every other month from microdust and you'll be fine (mine is running just as cool since 2 years ago), using compressed air directly into the vents, no need to dismantle anything. Just use very short bursts to prevent condensation and overspinning the fans.

    • Upvote 2
  5. Run this from a pivot in an empty map:

    If you change ViewRange to 0,1,2 or 3 it works. But 4, skips the nav entirely.

     

    function Script:Start()
           ground=Model:Box()
           shape=Shape:Box(0,0,0, 0,0,0, 1,1,1)
           ground:SetShape(shape)
           ground:SetScale(40,1,40)
      	 ground:SetNavigationMode(true)
    
           player=Prefab:Load("Prefabs/Player/FPSPlayer.pfb")
    
           for n=0,10
           do
               local b=Model:Box()
               b:SetShape(shape)
               b:SetPosition(n,1,n)
               b:SetScale(n,1,1)
               b:SetViewRange(4)  -- this kill navigation
               b:SetOcclusionCullingMode(false)
               b:Turn(0,Math:Random(-15,15),0)
               b:SetNavigationMode(true)
           end
    
           shape:Release()
    
           self.world=World:GetCurrent()
           self.world:BuildNavMesh()
    
           camera=player.script.camera
           camera:SetDebugNavigationMode(true)
    end

  6. till I can work out what's going on with ATI.

     

    ATI have picky compiler, maybe the log reveals the error.

    But things to look for are typical float to vecs or vecs to float conversions, vec4 to vec3 conversions etc..

    • Upvote 1
×
×
  • Create New...