Jump to content

Joh

Members
  • Posts

    474
  • Joined

  • Last visited

Posts posted by Joh

  1. I am sorry i completely forgot of this post :lol:

    Yeah Josh already told you how to do it, also there is a glow/bloom shader for mesh wich i never understood how it's working, i saw it use another texture but i didn't understood wich material we shall use..

    Josh could you explain it?

  2. I have a shader ready to use, and i add in a model. How i can change the texture of this shader, by programming? For example, in the file .mat, which has "texture0='tex.dds'", i want pass this parameter for programming. Whats function for this?? But the texture, in really, is a buffer. I get the screen with the GetColorBuffer(), and wanna pass this, to parameter of the shader. Like a reflect, which a camera render the world, and passes the image to texture, which in this case, would the shader..

    Could this help you?

    SetMaterialShader

     

    And other issue...

    I have two cameras, one is the main camera from framewerk, and other, is the a camera, which myself create, in a file .lua, of the a model. In this file, i change sometimes the visios between they. But, all time which i change the camera, and render, it render only models, and terrain, and the skybox renderized, is the same skybox, renderized froum framewerk camera. I want to know, how i can renderized, the background from second camera? Without merge, the image(models and terrain) of the first camera, with the skybox of the second camera..

    Could you should us the code? I am not sure, but myabe i know why..

  3. What i am tryng to explain is that you use framewerk wich have 3 worlds in total.. With your cam you don't renderize those worlds, so the cam won't be able to see them.

    RenderWorld()

    With this command you renderize only the current world, so you will probably fix the problem when you'll renderize every world in the correct order..

    So it should be BG, World and transparency.

  4. I used quite a lot amount of engines in last year and just a few have complicated math.

    The main difference is the amount of code to do something, as for example in torque i was obly to write 10 line of code to get the controller and 3 to update it, wich is almost 2 line in leadwerks.

    Unity isn't much harder then Leadwerks so just avoid to speak about it.

    Another good difference is that in leadwerks we could create a game by scratch but still be able to use framew(e/o)rk, that's help really much.

    I haven't really never used the tool wich are in leadwerks too, i prefer to code everything by myself.

     

    3DVIA Virtools is also easy, just a little confusing, but also buggy.

     

    So porbably i prefer leadwerks because leave me the possibility to write code easly, without a bad own scrript lagnuages, with a big amount of own command (so i don't need to lose my time to check in any class of the engine to understand..).

  5. Can't try it now (i am working) but i'll do when i'll be in my home.

    Anyway i looked at it, and don't know why is working.

     

    	ballControlPivot = CreatePivot()
           move   = KeyDown(KEY_W)-KeyDown(KEY_S)
    strafe = KeyDown(KEY_D)-KeyDown(KEY_A)	
    force  = Vec3(strafe*Speed,0,move*Speed)
           force  = TFormVector(force,ballControlPivot,nil) 
           ballBody:AddForce(force,1) 	
           ballControlPivot.SetPosition(ballBody.GetPosition())

    This should work probably better.. Also in this case you could rotate your ball in any rotation without worryng about camera.

     

    EDITED:

    Noticed that ballPivot was already used..

  6. My mind theoraticly understands what your saying, but sometimes it just doesn't seem to 'get' the logical part.

    I don't like this answer <_<

     

     

    So look this image The black lines are global space (the 3d coord.) the black square is your cam, and the red line are the local space of your cam.

     

    What are you doing is asking to calculate the force based on the cam pos and rot (wich is wrong if you wanna have a free cam) so probaly it will be better to create a pivot and place it in the same position of the ball and use that pivot to calculate the force, also if you wanna rotate the ball you should instead rotate the pivot.

     

    ballBody:AddForce(force,1)

    ARE YOU SURE THIS WORK??? It's really strange if it is.. Look here:

    AddBodyForce( body:TBody, force:TVec3 [, global:Int=1 ] )

    [, global:Int=1 ]

    This mean that as for default is 1.

    post-702-12722884801115_thumb.png

  7. Of course it do!

    force  = TFormVector(force,fw.main.camera,nil) 

    In this part of code you are telling :

    Find the position of force (strafe and move so lateral and frontal) starting as camera current position and rotation (local space of camera).

     

    Tform TransFORM the space from global to local and so on. So using the camera as referred point it will find that point BASED on camera. You should use another entities if you don't want have weird movement.

    • Upvote 1
  8. Thanks Joh, I'm writing my whole game in Lua.

    Just sorry me.. It's monday..

    If use the code as it is then the Player can pick the whole scene which is not good.

    Just a fast question.. Did you place the whole scene into a mesh?

    Anyway i didn't refered to that command but to this one (entity.collisiontype finally in lua :) )

    If the mesh are separated (each one) you surely used a collisiontype to let it collidable, so you could set a different collision type to check if you can pick them or not.

     

    In this case you simply could do the pick testing and check if that mesh is of that specific type.

  9. Ok i'll try, so many time i don't use bmax..

    Anyway you can always set a different type to a mesh (EntityType)

    And check if that picked object is that type. (GetEntityType)

     

    If you don't need this just explain exactly what you need. Almost everything it can be done using filters, wich is a sort of callback function that return 0 to skip or 1 to check the raycast.

  10. It show you how to create a simply cube, apply a material and rotate a mesh.

    Never heard about "hello world"? Those are the "basic" of the engine, if you don't know how to manage it you won't be able to do anything!

  11. There are a lot of tutorial on the web on c++, some are really easy to use.

    If your main objective is to become a programmer so i really suggest to start from there, if you only wanna design and create your own game on Leadwerks, you don't need to study a lot as Leadwerks use is own command.

    Anyway in both cases you always need the base of programming.

  12. Still one of the biggest things I think that is needed is the ability for bodies made via Lua to be able to handle collisions. I use triggers all over the place in Unity. It's so very helpful and would be a very useful addition to LE's Lua implementation.

    Should be done for me too.

  13. Yeah something like this.. I haven't tested it.

     

    'Use the Leadwerks Engine module as our base
    
    Framework leadwerks.engine
    
    'Create an OpenGL graphics window 
    Graphics 800, 600
    
    'Allows the engine to find files and load files from zip packages 
    RegisterAbstractPath AppDir
    
    'Create a world 
    If Not CreateWorld() RuntimeError "Failed to create world."
    
    'Create a camera 
    cam:TCamera = CreateCamera()
    CameraClearColor(cam, Vec4(0, 0, 1, 1))
    MoveEntity cam, Vec3(0, 30, -10)
    
    'create a ligt
    light:TLight = CreateDirectionalLight()
    RotateEntity(light, Vec3(65, 45, 0))
    
    'Create a render Buffer
    buffer:TBuffer = CreateBuffer(800, 600, BUFFER_COLOR | BUFFER_DEPTH | BUFFER_NORMAL)
    
    'create a mesh
    cube:TMesh = CreateCube()
    sphere:TMesh = Createsphere()
    positionentity sphere,vec3(0,10,0)
    
    Local pick:TPick
    
    'create materials
    selectionmaterial:TMaterial = CreateMaterial()
    SetMaterialColor(selectionmaterial, Vec4(1, 0, 0, 1))
    
    pointentity cam , cube
    
    debugphysics(1)
    
    depth:Float = 0.0
    near:Float = 1.0
    far:Float = 10.0
    'MODIFY
    local pick:TPick = null
    
    'Main loop 
    While Not KeyHit(KEY_ESCAPE) 
           'MODIFY
           local check:int = false
           'pick objects with the mouse
           If MouseDown(1)
                   'MODIFY
                   check = true
                   PaintEntity(cube, 0)
                   PaintEntity(sphere, 0)
                   'MODIFY
                   if pick = null 
                           pick = CameraPick(cam, Vec3(MouseX(), MouseY(), 1000))
                   endif
    
                   If pick Then
                           PaintEntity(pick.entity, selectionmaterial)
                           glReadPixels(MouseX(), GraphicsHeight() - MouseY(), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, Varptr(depth))
                           z:Float = near / (far - depth * (far - near)) * far;
                           pos:TVec3 = CameraProject(cam, Vec3(MouseX(), MouseY(), z))
                           positionentity (pick.entity, Vec3(pos.x,pos.y,pos.z))
                   End If
    
           End If
    
           'Update timing, physics, and other miscellaneous updates 
           UpdateWorld
    
           'Draw the world 
           SetBuffer(buffer)
           RenderWorld
           'MODIFY
           if check = flase then pick=null
    
           DrawText "Depth: " + depth, 0, 0
           DrawText "Projected: " + pos.x + ", " + pos.y + ", " + pos.z,0,12
    
           'render lighting
           SetBuffer(BackBuffer())
           RenderLights(buffer)
    
    
           'Swap the graphics buffers so we can see what we drew 
           Flip
    Wend

×
×
  • Create New...