mirror of
https://github.com/teverse/teverse
synced 2025-08-25 23:54:46 +02:00
Compare commits
3 Commits
c66a2e37d6
...
0aee56b9ce
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0aee56b9ce | ||
![]() |
3965e10cd5 | ||
![]() |
7b85123995 |
@ -43,6 +43,33 @@ return {
|
||||
position = vector3(0.5, 1, 0),
|
||||
mesh = "primitive:sphere"
|
||||
})
|
||||
|
||||
-- this debug code needs to be moved elsewhere
|
||||
|
||||
-- block:on("collisionStarted", function (collidingWith, hit, normal)
|
||||
-- local b = engine.construct("block", workspace, {
|
||||
-- position = hit,
|
||||
-- physics = false,
|
||||
-- size = vector3(0.1, 0.1, 0.1),
|
||||
-- mesh = "primitive:sphere"
|
||||
-- })
|
||||
-- wait(1)
|
||||
-- b:destroy()
|
||||
-- end)
|
||||
|
||||
-- spawnThread(function ( ... )
|
||||
-- while wait() do
|
||||
-- local mouseHit = engine.physics:rayTestScreen( engine.input.mousePosition )
|
||||
-- if mouseHit then
|
||||
-- local b = engine.construct("block", workspace, {
|
||||
-- position = mouseHit.hitPosition,
|
||||
-- physics = false,
|
||||
-- size = vector3(0.1, 0.1, 0.1),
|
||||
-- mesh = "primitive:sphere"
|
||||
-- })
|
||||
-- end
|
||||
-- end
|
||||
-- end)
|
||||
end,
|
||||
|
||||
setupEnvironment = function ()
|
||||
|
@ -47,14 +47,21 @@ return {
|
||||
-- tell history to monitor changes we make to selected items
|
||||
history.beginAction(selection.selection, "Hand tool drag")
|
||||
|
||||
local grid = engine.construct("grid", workspace, {
|
||||
step = 0.5,
|
||||
colour = colour(1,0,0),
|
||||
size = 10
|
||||
})
|
||||
|
||||
while engine.input:isMouseButtonDown(enums.mouseButton.left) do
|
||||
-- fire a ray, exclude selected items.
|
||||
local hits, didExclude = engine.physics:rayTestScreenAllHits(engine.input.mousePosition, selection.selection)
|
||||
if (#hits > 0) then
|
||||
local newCentre = hits[1].hitPosition + mouseOffset
|
||||
grid.position = newCentre
|
||||
for _,v in pairs(selection.selection) do
|
||||
if offsets[v] then
|
||||
v.position = offsets[v] + newCentre
|
||||
v.position = newCentre - offsets[v]
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -63,6 +70,7 @@ return {
|
||||
|
||||
history.endAction()
|
||||
|
||||
grid:destroy()
|
||||
else
|
||||
-- user clicked an unselected object, let's select it
|
||||
if engine.input:isKeyDown(enums.key.leftShift) then
|
||||
|
Loading…
x
Reference in New Issue
Block a user