Jump to content

Tomas

Members
  • Posts

    40
  • Joined

  • Last visited

Posts posted by Tomas

  1. Finally sorted this out myself. That's the code now:

    Script.a=0
    Script.mtl=NULL
    Script.srf=NULL
    Script.col=Vec4()
    function Script:Start()
    	self.srf = self.entity:GetSurface(0);
    	self.mtl=self.srf:GetMaterial()
    end
    
    
    
    function Script:UpdateWorld()
    	self.col=self.mtl:GetColor()
    	self.col.r = self.col.r
    	self.col.g = self.col.g
    	self.col.b = self.col.b
    	self.col.a = self.col.a-self.a
    	self.mtl:SetColor(self.col)
    	self.a=self.a+0.0001	
    end

     

  2. Script.a=0
    Script.mtl=NULL
    Script.srf=NULL
    
    function Script:Start()
    	self.srf = self.entity:GetSurface(0);
    	self.mtl=self.srf:GetMaterial()
    end
    
    
    
    function Script:UpdateWorld()
    	self.mtl:SetColor(255,255,255,self.a)
    	self.a=self.a+0.001	
    end

    That's the lua skydome code I have so far.

    It goes from transparent to solid, but theres no texture, just color. If I remove "SetClolor()" the texture is back to place. Any ideas?

     

     

  3. I've sorted out shadows. The shadows checkbox in terrain/vegetation was not checked. But the leave movement is still not working. I wander could that be a geometry problem. I used rectangles divided in a half by width and height, so in one plane there is 4 faces.

  4. Hi. I've created a tree in blender similar to pine tree that comes with LE. But the tree in LE has moving branches and my branches dont move. Material settings and shaders are identical to the pine in LE. Used PNG as textures. Also branches dont cast shadow on each other even if the ''cast shadow'' box is set in material. The shadow casted is only on the ground. Any ideas what im doing wrong?

    post-9380-0-31545800-1493666023_thumb.jpg

  5. I used a variable for picking and when a cursor was on the tree it was positive, also the tree material picking flag is set. I assume that picking is possible, but is it possible to ineract like change rotation?

    ...
    if self.camera:Pick(mousepos.x,mousepos.y,pickinfo) then
    self.picked_entity=pickinfo.entity
    if window:KeyDown(Key.L) then
     self.ok_picked=1
     --pickinfo.entity:Hide()
     pickinfo.entity:Turn(0,Time:GetSpeed()*0.5,0)
    else
     self.ok_picked=0
    end
    end
    ...
    

     

    self.ok_picked ws positive when cursor was on the tree

  6. .....
    if self.camera:Pick(mousepos.x,mousepos.y,pickinfo) then
       self.picked_entity=pickinfo.entity
       if window:KeyDown(Key.L) then
       pickinfo.entity:Turn(0,Time:GetSpeed()*0.5,0)
       end
    end
    ......
    

    Hi is it possible in any ways to inerract with terrain vegetation, like trees? I want trees to be cuttable, is there any way to do this? I tried picking, it picks the tree but any interaction like moving, hiding, rotating wont work

  7. Finally got it working. A bit laggy, but working. Theres my code:

     

    Script.buffer=0
    Script.mapcam=0
    function Script:Start()
    ....
    self.camera=Camera:Create()
    self.camera:SetRotation(0,0,0)
    self.camera:SetPosition(self.entity:GetPosition(true)+Vec3(0,1.8,0))
    self.buffer = Buffer:Create(100, 100, 1, 1, 0)
    self.mapcam = Camera:Create()
    self.mapcam:SetRenderTarget(self.buffer:GetColorTexture())
    end
    function Script:UpdateWorld()
    ....
    local buff=Buffer:GetCurrent()
    Buffer:SetCurrent(self.buffer)
    world:Render()
    Buffer:SetCurrent(buff)
    end
    function Script:PostRender(context)
    ....
    context:DrawImage(self.buffer:GetColorTexture(),0,0,100,100)
    end
    

     

    Didnt managed to get "camera:Render()" to work. Any ideas? The code actually renders same scene..

×
×
  • Create New...