Skip to content
Discussion options

You must be logged in to vote

Example: cuboids-from-lua-box3d-defold.zip (989.4 KB)

It looks the same like the example above but it creates cuboids from Lua:

-- Create Static Ground (Rotated 10 degrees around Z axis)
-- Parameters: type, x, y, z, hx, hy, hz, rotation_degrees
box3d.create_box("static", 0.0, -2.0, 0.0, 5.0, 0.2, 5.0, 10.0)

-- Create First Dynamic Falling Box
-- Parameters: type, x, y, z, hx, hy, hz, rotation (nil), density
box3d.create_box("dynamic", 0.0, 5.0, 0.0, 0.5, 0.5, 0.5, nil, 1.0)

-- Create Second Dynamic Falling Box (Offset position)
box3d.create_box("dynamic", 0.75, 7.0, 0.0, 0.5, 0.5, 0.5, nil, 1.0)

print("Successfully spawned ground and boxes from Lua!")

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@ivan-enzhaev
Comment options

@ivan-enzhaev
Comment options

@ivan-enzhaev
Comment options

Comment options

You must be logged in to vote
1 reply
@ivan-enzhaev
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ivan-enzhaev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant