Jump to content
YouGroove

Road system for terrain

Recommended Posts

Hi ,

 

A road system for terrain, whatever is the system, from simple terrain flattening , to polygon terrain system, it would look lot better for people needing to make today roads ( it would help for game cars also).

 

Without it , it's longer to make and not as good.

wroad.jpg

Share this post


Link to post

The road system I implement is going to be awesome because the roads will get baked into the terrain clipmap renders. They will be part of the texture, and not a separate piece of geometry, like in Rage or Quake Wars: Enemy Territory.

Share this post


Link to post
The road system I implement is going to be awesome because the roads will get baked into the terrain clipmap renders. They will be part of the texture, and not a separate piece of geometry, like in Rage or Quake Wars: Enemy Territory.

 

 

you mean like that ?

 

Will it be possible to make a road crossing another or a road divinding in two roads or two roads joining another one ?

I think about racing games shortcuts and alternative path.

Share this post


Link to post

You mean like this?

 

rage-pc-005.jpg

Yes and yes. Although I don't know all the details yet, but it will be good. It's one of the benefits of the way I designed the terrain, although we haven't gotten to enjoy it yet.

Share this post


Link to post

Yes and yes. Although I don't know all the details yet, but it will be good. It's one of the benefits of the way I designed the terrain, although we haven't gotten to enjoy it yet.

 

excellent, josh

Share this post


Link to post

This will carve roads using pivot childs and splines.

Second terrain layer will be road color.

 

http://www.leadwerks.com/werkspace/page/viewitem_?fileid=404532791

 

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


function Script:Start()
   --get world and terrain
   local world=World:GetCurrent()
   for i=0,world:CountEntities()-1 do
		    if world:GetEntity(i):GetClass()==Object.TerrainClass then
				    self.terrain=world:GetEntity(i)
				    tolua.cast(self.terrain,"Terrain")
				    break
		    end
 end

    --## Adust this t terrain size
    local terrainsize=256

    while self.terrain == nil
    do
       System:Print("....")
    end

    local points = {  }
    for d=self.entity:CountChildren()-1,0,-1
    do
       local e = self.entity:GetChild(d)
       System:Print( "Pivot Childs:"..e:GetKeyValue("name") )

       if self.entity:GetChild(d)~=nil then

       x=terrainsize/2+self.entity:GetChild(d):GetPosition(true).x
       y=terrainsize/2+self.entity:GetChild(d):GetPosition(true).z
       h=self.terrain:GetHeight(x,y)

       table.insert( points, {
           x=x,
           y=y,
           h=h
           } )
       end
       --System:Print(x.." "..y.." "..h)
    end


   local spline = smooth( points )
   local colorspline = smooth( points,100 )

   for x=1,#colorspline-1,1
   do
       self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y,1)

       self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y+1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y+1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y+1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y+1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y+1,1)

       self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y-1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y-1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y-1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y-1,1)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y-1,1)

       self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y+2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y+2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y+2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y+2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y+2,.5)

       self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y-2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y-2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y-2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y-2,.5)
       self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y-2,.5)
   end

   for x=1,#spline-1,1
   do


       self.terrain:SetHeight(spline[x].x, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x, spline[x].y+4, spline[x].h, false)



       self.terrain:SetHeight(spline[x].x+1, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y+3, spline[x].h, false)    
       self.terrain:SetHeight(spline[x].x+1, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+1, spline[x].y+4, spline[x].h, false)    


       self.terrain:SetHeight(spline[x].x-1, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-1, spline[x].y+4, spline[x].h, false)


       self.terrain:SetHeight(spline[x].x+2, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+2, spline[x].y+4, spline[x].h, false)


       self.terrain:SetHeight(spline[x].x-2, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-2, spline[x].y+4, spline[x].h, false)


       self.terrain:SetHeight(spline[x].x+3, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+3, spline[x].y+4, spline[x].h, false)


       self.terrain:SetHeight(spline[x].x-3, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-3, spline[x].y+4, spline[x].h, false)


       self.terrain:SetHeight(spline[x].x+4, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x+4, spline[x].y+4, spline[x].h, false)


       self.terrain:SetHeight(spline[x].x-4, spline[x].y, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y-1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y+1, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y-2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y+2, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y-3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y+3, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y-4, spline[x].h, false)
       self.terrain:SetHeight(spline[x].x-4, spline[x].y+4, spline[x].h, false)
   end
end

Share this post


Link to post

This will carve roads using pivot childs and splines.

Second terrain layer will be road color.

 

http://www.leadwerks.com/werkspace/page/viewitem_?fileid=404532791

 

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


function Script:Start()
--get world and terrain
local world=World:GetCurrent()
for i=0,world:CountEntities()-1 do
		 if world:GetEntity(i):GetClass()==Object.TerrainClass then
				 self.terrain=world:GetEntity(i)
				 tolua.cast(self.terrain,"Terrain")
				 break
		 end
 end

--## Adust this t terrain size
local terrainsize=256

while self.terrain == nil
do
System:Print("....")
end

local points = { }
for d=self.entity:CountChildren()-1,0,-1
do
local e = self.entity:GetChild(d)
System:Print( "Pivot Childs:"..e:GetKeyValue("name") )

if self.entity:GetChild(d)~=nil then

x=terrainsize/2+self.entity:GetChild(d):GetPosition(true).x
y=terrainsize/2+self.entity:GetChild(d):GetPosition(true).z
h=self.terrain:GetHeight(x,y)

table.insert( points, {
x=x,
y=y,
h=h
} )
end
--System:Print(x.." "..y.." "..h)
end


local spline = smooth( points )
local colorspline = smooth( points,100 )

for x=1,#colorspline-1,1
do
self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y,1)

self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y+1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y+1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y+1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y+1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y+1,1)

self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y-1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y-1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y-1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y-1,1)
self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y-1,1)

self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y+2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y+2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y+2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y+2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y+2,.5)

self.terrain:SetLayerAlpha(0,colorspline[x].x, colorspline[x].y-2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x+1, colorspline[x].y-2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x-1, colorspline[x].y-2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x+2, colorspline[x].y-2,.5)
self.terrain:SetLayerAlpha(0,colorspline[x].x-2, colorspline[x].y-2,.5)
end

for x=1,#spline-1,1
do


self.terrain:SetHeight(spline[x].x, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x, spline[x].y+4, spline[x].h, false)



self.terrain:SetHeight(spline[x].x+1, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+1, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x-1, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-1, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x+2, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+2, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x-2, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-2, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x+3, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+3, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x-3, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-3, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x+4, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x+4, spline[x].y+4, spline[x].h, false)


self.terrain:SetHeight(spline[x].x-4, spline[x].y, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y-1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y+1, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y-2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y+2, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y-3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y+3, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y-4, spline[x].h, false)
self.terrain:SetHeight(spline[x].x-4, spline[x].y+4, spline[x].h, false)
end
end

 

I'm trying to implement this code. I modified it to use layer 1 as the road, instead the entire layer disappears. Any idea why?

Share this post


Link to post

Looks like the path works but the road texture is not painted on the road (the road should be brown).

 

How does Terrain::SetLayerAlpha works? There's no document anywhere.

 

uk1w6SJ.png

Share this post


Link to post

Wow. If this get fixed, with the proper shader, we could also use it for a a river tool by animating the UV texture (from what I see this is only possible by creating a shader for a material).. I'll try to bookmark this thread.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...