Jump to content

Santiago3D

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Santiago3D


  1. Hi, thanks, achieve using the Help move the vertices using a script.

    I move the vertices, I had to reduce the amount of vertices since vertex moving vertex seems to be a slow process.

    Q1. If I did this using a shader would it be faster?

    Q2. Something I must be doing wrong, since I get an error the minute I run the application, surely I am accumulating memory somewhere and I do not know where.

    I share the Script on the water mesh to see if they help me find what is wrong.

     

    function Script:Start()
    	surface = self.entity:GetSurface(0)
    end
    
    Script.wave_vel = .1 --float "Wave Speed"
    
    function Script:UpdateWorld()
    		for  v=0, surface:CountVertices()-1 do
    			local position = surface:GetVertexPosition(v) 
                local color = surface:GetVertexColor(v) --float 
    			position.z = Math:Sin((position.x*position.y)+Time:GetCurrent()*self.wave_vel)
    			color.r = 100-position.z*.2
    			color.g = 110-position.z*.2
    			color.b = 120-position.z*.2
    			surface:SetVertexPosition(v,position) 
                surface:SetVertexColor(v,color) 
    	end
    end

    0FC1E65A3AE4C2EB3BFD6204573E94B0B2A03058

    battleship3.JPG

  2.  

    Hello, I am learning Leadwerks, and for that I am doing a little game of a boat.

    All my programming experience is with Blitz3D, and now I decided to migrate my projects to Leadwerks.

    I could already make the boat sail, rotate the turret, raise the cannon and shoot cubes.

    Now I would like to know how I can modify my water MESH, I want to move its vertices to generate a wave effect.

    Is there any example of a SCRIPT to control the position of the vertices of a mesh?

    Sorry for the way I write, I'm using google translate.

    Regards!
    Santiago

    Battelship2.JPG

  3.  

     

    Hi, on the advice of a friend I am testing leadwerks, so far all my games have been programmed with Blitz3D, but I need to expand my horizons, especially in graphical limitations, so I am learning how to use Leadwerks.

    I spent all week trying to understand how Leadwerks, Lua, Shaders, CPU / GPU works ... hours and hours of youtube and see the forum, and I make my fist steps in Leadwerks in a simple game.

    To learn I decided to make a game of a boat, which must defend and attack in a small lake.

    Until now, achieve:

    - Import objects from 3dsmax
    - Assign materials to objects.
    - Make a script to move the boat
    - Make a script to rotate the turret
    - Make a script to change the elevation of the cannon. And when you press SPACE, shoot.

     

     

    I have a thousand questions to ask, but I want to try to discover it on my own. Although some I think it is better to ask them so I already learn to make the code in the correct way. When I press SPACE I create an ammunition, but how do I do it? And how do I check all the ammunition and move them, according to your SCRIPT. And mainly, where should the code go to review all the ammunition in each loop? 

    Greetings, Santiago

    Battelship1.JPG

×
×
  • Create New...