Jump to content

Andy Gilbert

Members
  • Posts

    533
  • Joined

  • Last visited

Posts posted by Andy Gilbert

  1. Trying to check for key inputs in lua but struggling.

     

    I tried :

    if KeyDown(KEY_SPACE)==1 then                        
    	model1body:AddForce(Vec3(0,0,100))	
    end

     

    Which didnt work, so i then tried :

    if KeyDown(KEY_SPACE)==1 then                        
    	AppTerminate=1	
    end

     

    Which also does nothing....

     

    thanks

    Andy

  2. They should all be. If you want to see exactly how they are exposed, see my thread in this forum talking about exposing Lua commands in BMX.

     

    Hmm not sure if i understand that, all i need know is commands, which im sure many others do to: for isntance like now, im trying to set the entity type in lua?

     

    I havnt got a clue what it is, ive tried the obvious:

     

    model1:EntityType(1) - nope

    model1:SetType(1) - nope

    model1:CollisionType(1) - nope

     

    I dare say you could tell me... but then ill only get to the next command i need and same prob.

     

    Also whilst your here...

     

    Ive noticed some commands arnt syntaxed? or color coded?

     

    For instance:

    model1=LoadMesh("abstract::simple.gmf")
    model1:SetPosition(Vec3(0,2,5))
    model1:SetScale(Vec3(0.1,0.1,0.1))
    model1body=CreateBodyBox(2,2,5)
    model1:SetParent(model1body)
    model1body:SetMass(1)

     

    SetScale , Setmass arnt yet they work fine.

     

    Thanks

    Andy

  3. Without a demo, I can only guess what you might be doing.

     

     

    Ok ,well ive now found out what the prob is (which i thought you might of picked up on)

     

    I was using the command PositionEntity where as in lua it seems its SetPosition? I was under the impression most commands where the same?

     

    is there not a compiled list of the lua commands for LE as it seems its just a guessing game?

     

    Andy

  4. well ill post a demo if you want but it can easily be replicated? the scene it nothing but a terrain and the model is a cube?

     

    But the loading of stuff doesnt seem a problem..

     

    It just literally crashes when i try to use the commands PositionEntity and also ive noticed EntityType?

     

    Andy

  5. Ok.. Al im trying to do is in the lua editor outside of the editor, load a scene and place a model inside it?

     

    The code..

     

    RegisterAbstractPath("")
    
    --Set graphics mode
    if Graphics(1024,768)==0 then
    Notify("Failed to set graphics mode.",1)
    return
    end
    
    world=CreateWorld()
    if world==nil then
    Notify("Failed to initialize engine.",1)
    return
    end
    
    gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),1+2+4+8)
    
    
    scene=LoadScene("abstract::scene.sbx")
    
    model1=LoadMesh("abstract::simple_1.gmf")
    PositionEntity(model1,Vec3(-1,2,0))
    
    
    camera=CreateCamera()
    camera:SetPosition(Vec3(0,20,0))
    camera:Turnf(0.0,42,0.0)
    
    Collisions(1,1,1)
    
    
    while AppTerminate()==0 do
    
    
    
    UpdateAppTime()
    world:Update(AppSpeed())
    
    SetBuffer(gbuffer)
    world:Render()
    SetBuffer(BackBuffer())
    world:RenderLights(gbuffer)
    
    DrawText(UPS(),0,0)
    Flip(0)
    end

     

    Ok the above just crashes when you try to run it, remove the line PositionEntity(model1,Vec3(-1,2,0)) and it loads, but cannot see the model?

     

    am i doing it wrong?

     

    Andy

  6. ok well doing this :

     

    dofile("Scripts/base.lua")
    
    function Spawn(model)        
    local entity=base_Spawn(model)
    	FreeEntity(model)                 
    	body1=CreateBodyBox(0,0,0)                
    	EntityParent(model,body1)                
    	body1:SetMass(10)        
    return entity
    end
    

     

    Crashes the editor...

     

    i think im just going to forget about things for a week or so untill some sort of docs are done or things are sorted as its clearly very unsupported at the moment and obviosuly still has issues...

     

    Andy

  7. I think you shouldn't do that, but if you do, you need at least to set EntityType(body1,1). Although I think that command does not exist in LUA.

     

    I use only physics shapes created with phygen, it makes life much easier as then I can control their mass and other settings from the properties dialog.

     

    So.. i cannot create bodyboxes in lua?

     

    Andy

  8. Ok, so how do i retrieve the body that is created by either phygen in lua to add another one?

     

    Edit: thiss is what i have...

     

    A model that has a phygen file which has a mass of 1.. if i put that in the editor as it is, it slowly falls to the terrain and does a small bounce and stop (all good).

     

    If i then enter this into the lua script for the model:

     

    dofile("Scripts/base.lua")
    
    function Spawn(model)
    local entity=base_Spawn(model)
    	body1=CreateBodyBox(0,0,0)
    	EntityParent(model,body1)
    	body1:SetMass(10)
    return entity
    end
    
    

     

    It then falls threw the terrain, if i remove the SetMass line it works ok.

     

     

    thanks

    Andy

  9. You don't need to create a physics body with LUA, just make a phy file with phygen for it.

     

    But... if my model is a complex shape the physics seems to be just in the middle of the model and parts of my model go threw the terrain still?? So i though about using a main body and then attatching more bodies to the main, that way i can also add forces on different bodies but on the same model, just in different areas of the model.

     

    Andy

  10. Hi... i would just like to say, this poll cold be slightly deceiving. What i mean by that is, i guess you may use a poll for many reason but one reason would be so you know what direction to aim LE for, for such things as.. support, examples, documention, headers, tutorials ETC (may be not be the case here, but this is just in case you intent to). Well, i voted C++ simply because thats what i am currently using, but not by choice. Simply beacuse that is what is most currently supported for... for example the tutorials... there nearly all aimed at C++ and so i download MSVC++ and went from there, but i would much prefer to use blitmax and i know that if there was as many tutorials and examples for blitzmax than there was for C++ then my vote would be for blitzmax, not C++.

     

    Not a rant, just thought ide say as i feel with the way results are going this will only push you more towards c++ users.

     

    Maybe a poll for "what would you prefer to use" :D

     

    Thanks

    Andy

  11. Hi, ok in the editor i have my model and in the lua script attatched to the model i have create a spawn function where i create a physics body and give it a mass and parent it to my model, but then with physics on its simply sinks threw the terrain? How do i make it collide with it?

     

    Ive tried giving the body a collision type 1, but doesnt seem to do anything?

     

    Thanks

    Andy

  12. I also experience that in the script editor opened via the editor, i can get a few lines of code that seems to crash both script editor and the editor and then if i try to load that scene back up again, it just simple instantly crashes.

     

    So i have to go and open the script up in notepad remove the code thats crashing it and then load it back up.

     

    Very annoying.

     

    Andy

  13. Unforutnatly im still locked out the forums and i have a questions so this si the only place i can ask.

     

    There two things: Ok..

     

    1st. How can i Show a var as text on the display? I can show text all ok, but dont know who to shows variables.

     

    2nd. Can find any C++ examples on this (why is there such a mix of C++/C/blitzmax examples in the wiki???) anyways, im trying to get the rotation of a mesh, i can see how its done using blitzmax, but i cant seem to get it to work the same way in C++.

     

    Thanks

    Andy

×
×
  • Create New...