Jump to content

Skrakle

Members
  • Posts

    79
  • Joined

  • Last visited

Posts posted by Skrakle

  1. Thanks for the reply!

     

    I've tried what you suggested, i was able to make it move using AddForce but the movement it's very erratic and when it stops, it sort of slides and falls down and the same problem occurs when it hits a bump in the terrain, the model is pushed away and falls to the ground again and i haven't used PhysicsSetPosition nor SetPosition this time.

  2. I have a moving model on my terrain, when it collides while climbing on what i sculped or another entity, they bounce back, how can i prevent from doing that?

     

    Thanks

     

     

    x=0;y=0;z=-20;
    camx=-5;camy=20;camz=-15;
    camrx=45;camry=15;camrz=0;
    
    function App:Start()
    --Initialize Steamworks (optional)
    Steamworks:Initialize()
    
    --Set the application title
    self.title="Test"
    
    --Create a window
    local windowstyle = window.Titlebar
    if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end
    self.window=Window:Create(self.title,0,0,System:GetProperty("screenwidth","1280"),System:GetProperty("screenheight","720"),windowstyle)
    self.window:HideMouse()
    
    --Create the graphics context
    self.context=Context:Create(self.window,0)
    if self.context==nil then return false end
    
    --Create a world
    self.world=World:Create()
    self.world:SetLightQuality((System:GetProperty("lightquality","1")))
    
    --Load a map
    local mapfile = System:GetProperty("map","Maps/test.map")
    if Map:Load(mapfile)==false then return false end
    
    
    
    self.model={}
    self.model[0] = Model:Load("testmodel.mdl")
    self.model[0]:SetScale(0.05);
    self.model[0]:SetPosition(x,y,z);
    self.model[0]:SetMass(1);
    self.model[0]:SetCollisionType(Collision.Prop);
    
    self.model[1] = Model:Load("testmodel.mdl")
    self.model[1]:SetScale(0.05);
    self.model[1]:SetPosition(x+15,y,z-15);
    self.model[1]:SetMass(1);
    self.model[1]:SetCollisionType(Collision.Prop);
    
    self.model[0]:SetShape(Shape:Box(6.81,48.805,-7.7830, 0,0,0, 49.809,98.074,42.164))
    self.model[1]:SetShape(self.model[0]:GetShape())
    
    self.camera = Camera:Create();
    self.camera:SetPosition(camx+x,camy+y,camz+z);
    self.camera:SetRotation(camrx,camry,camrz);
    return true
    end
    

     

     

     

     

     

     

    function App:Loop()
    
    
    --If window has been closed, end the program
    if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end
    
    local run=0;
    local rot=0;
    
    if self.window:KeyDown(Key.Left) then
    x=x-0.15;
    rot=-180;
     run=1;
    end
    
    
    if run==1 then
    self.model[0]:PhysicsSetPosition(x,y,z,0.5)
     --self.model[0]:SetPosition(x,y,z);
    self.camera:SetPosition(camx+x,camy+y,camz+z);
    self.model[0]:SetAnimationFrame(Time:GetCurrent()/40.0,1,"Run")
    self.model[0]:SetRotation(Vec3(0,rot,0));
    end
    
    
    --Update the app timing
    Time:Update()
    
    --Update the world
    self.world:Update()
    
    --Render the world
    self.world:Render()
    
    --Refresh the screen
    self.context:Sync(true)
    
    --Returning true tells the main program to keep looping
    return true
    end
    

  3. Hey guys, great product, i love it! I have a few suggestions about the script editor:

     

    - Having a shortcut key to open it.

    - Prevent from closing window when pressing the ESC key.

    - Automatically re-open last lua files.

    • Upvote 2
×
×
  • Create New...