Skip to content

Commit

Permalink
merge physics material scene with demo scene
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Nov 14, 2024
1 parent bb027b9 commit d503a77
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 1 deletion.
File renamed without changes.
24 changes: 24 additions & 0 deletions data/maps/demo/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,34 @@ local interactive = false

label = {}
player = {}
cubeA = {}
cubeB = {}
sphereA = {}
sphereB = {}
sound = -1
local ik_target_input = -1
local ik_alpha_input = -1
local ik_co = nil
local cubeA_pos = {}
local cubeB_pos = {}
local sphereA_pos = {}
local sphereB_pos = {}

Editor.setPropertyType(this, "label", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "player", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "cubeA", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "cubeB", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "sphereA", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "sphereB", Editor.ENTITY_PROPERTY)
Editor.setPropertyType(this, "sound", Editor.RESOURCE_PROPERTY, "clip")

function start()
cubeA_pos = cubeA.position
cubeB_pos = cubeB.position
sphereA_pos = sphereA.position
sphereB_pos = sphereB.position
end

function playSound(sound)
local path = this.world.lua_script:getResourcePath(sound)
this.world:getModule("audio"):play(this, path, false)
Expand Down Expand Up @@ -73,6 +92,11 @@ function onInputEvent(event : InputEvent)
co.lerpVec3(this, "local_position", {0, 0, 0}, {0, 0, 0.1}, 0.1)
end
)
-- reset objects' positions
cubeA.position = cubeA_pos
cubeB.position = cubeB_pos
sphereA.position = sphereA_pos
sphereB.position = sphereB_pos
-- play a sound and wait a bit
playSound(sound)
co.wait(0.1)
Expand Down
Binary file modified data/maps/demo/demo.unv
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file removed data/universes/tests/physics_material.unv
Binary file not shown.
1 change: 0 additions & 1 deletion src/core/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ LUMIX_CORE_API Point clientToScreen(WindowHandle win, int x, int y);
LUMIX_CORE_API WindowHandle createWindow(const InitWindowArgs& args);
LUMIX_CORE_API void showWindow(WindowHandle wnd);
LUMIX_CORE_API void hideWindow(WindowHandle wnd);
LUMIX_CORE_API void enableDecoration(WindowHandle wnd, bool enable);
LUMIX_CORE_API bool getEvent(Event& event);
LUMIX_CORE_API void destroyWindow(WindowHandle wnd);
LUMIX_CORE_API Rect getWindowScreenRect(WindowHandle win);
Expand Down

0 comments on commit d503a77

Please sign in to comment.