Jump to content

Entity::SetGravity()


Alienhead
 Share

Go to solution Solved by Josh,

Recommended Posts

Is the mass set?

--Initialze Steam (optional)
--if not Steamworks.Initialize() then return 1 end

--Load FreeImage plugin (optional)
local fiplugin = LoadPlugin("Plugins/FITextureLoader")

--Get the displays
local displays = GetDisplays()

--Create a window
local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR)

--Create a framebuffer
local framebuffer = CreateFramebuffer(window)

--Create a world
local world = CreateWorld()
world:SetAmbientLight(1)

local cam = CreateCamera(world)
cam:Move(0,0,-4)

local box1 = CreateBox(world)

while window:KeyDown(KEY_ESCAPE) == false and window:Closed() == false do

    if window:KeyHit(KEY_SPACE) then
        box1:SetGravity(0,10,0)
        box1:SetMass(10)
    end

    --Garbage collection step
    collectgarbage()

    --Update the world
    world:Update()
    
    --Render the world to the framebuffer
    world:Render(framebuffer)
end

Steamworks.Shutdown()

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

Ah, I did not realize it is using player physics. That's a completely different "fake" physics simulation and I did not even think about it.

I am adding this now...

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...