Jump to content

Slastraf

Developers
  • Posts

    705
  • Joined

  • Last visited

Posts posted by Slastraf

  1. This is a really hard thing to do and unfortunately it only ever works with upright bone models. 
    I made spider legs but modeled them like this
    place bone, do not rotate scale etc
    extrude it to the top
    Then it is possible to rotate them, but also only tested with setrotation()

    • Like 1
  2. I see.
    You don't need a displacement map. This can easily be calculated
    this is basically a cos function in the range of [0, 8*pi]
    pixel(x,y) = cos((y/height)*3.1415926*8)

    Just to give you a headstart.
    To get the color information you would use the function from above like this disp = (pixel(x,y)*0.5+1)/255
    because cos goes from -1 to 1 and if we add one it goes from 0 to 2, then multiply by 0.5 to get from 0 to 1 and divide by 255 to get the color intensity.
     

    • Thanks 1
  3. The shader still calculates the height of the wave trough a function. It must contain sin / cos.
    If you copy that function to lua with the same parameters, it will have mathematically the same result. Which parameters would need to be converted from leadwerks global space to whatever space the shader operates.

  4. You would need to get the surface of the model. 
    Not tested here I will give you a tip:
     

    local model = Model:Load("Models/Grass/grass01.mdl")  
    local surface = model:GetSurface(0)
    local smallest = nil
    for v=0,surface:CountVertices()-1 do
        local position = surface:GetVertexPosition(v)
      	--multiply by scale (you mentioned 1500)
      	local vertDistance = self.entity:GetDistance(model:GetPosition()+(surface:GetVertexPosition(v)* 1500))
    	if smallest == nil or vertDistance < currDistance then
        	currDistance = vertDistance
    		smallest = v
        end
    end
    local posOfNearestVert = model:GetPosition()+(surface:GetVertexPosition(smallest)* 1500)

    This probably wont work on the first try, but is an example on how to approach this.
    Also you cannot directly get the vertex, but the position as presented

  5. When I move the player a long distance from the world origin,
    firstly the shadows disappear and after Z > 2000 the screen is totally black
    First it is all normal:
    1.PNG.a4019aedcad2ed0f77fc8455fcd29c31.PNG
    then shadows disappear
    2.PNG.d1ec73be5086ca7866df3753347e0182.PNG

    and then (z> 2000) only things from postrender get drawn on the screen.

    Position x:7.6799964904785 y:1.4799995422363 z:1264.5567626953 -- round about here shadows disappear (+-50)
    Position x:7.6799974441528 y:1.4799995422363 z:2033.2707519531 -- here black screen (+-50)

  6. Hello
    I have a problem creating a window in c++, when I use this 
     

    window = Leadwerks::Window::Create("Game Test",0,0,1280,720, Window::FullScreen);
    context = Context::Create(window);

    the window will appear correctly but as soon as I try to make it any resolution higher than 1920 1080 the window will not be created.
    a.thumb.PNG.c834a29ce74d1670e100bec4f5e57e62.PNG

    Is this some kind of surprise windows setting that causes this or is this a leadwerks bug?

  7. make a new script

    Script.first = nil --entity
    Script.second = nil --entity

    function Script:Start()

    if self.second == nil then System:Print(">> second is nil") end 

    end

    now drag two random things in each slot of the Script tab and run the game, nothing will happen.
    then click on the red x of "first" so it will disappear.
    Now for some reason, second will be nil when you run the game again.
    I don't know if it has some more details for reproduction but I think this should be enough.
     

  8. Have just gone "around" this issue like this
     

    Quote
    
    world:GetCurrent():ForEachEntityInAABBDo(self.entity:GetAABB(),"Callback",v) 

     

    and for some reason the camera was always in the aabb so i just checked if the entity in the parameter of callback was the camera

  9. How do I handle the camera creation in c++ ?
    I create a camera in c++ and it works fine but the Camera has no GetCurrent() so how do I pass it down to the player script ?
    Basically what is the equivalent of entity.script.camera in cpp ?

    I need the camera in both c++ and lua.

    a.PNG

  10. new script editor/better direct support for VS code
    better shader workflow(getting lots of engine side bugs while working with shaders)
    hair (alpha like leaves.shader but animated), outline shader for selecting things
    terrain heightmap generator (from 1..n noise funcitons with custom arguments)
     

×
×
  • Create New...