Page 6 of 6

Re: Alexar's Physics Editor(APE)

Posted: Mon Sep 26, 2016 9:58 am
by Alexar
all created by the editor, no code needed.
race.gif
race.gif (5.62 MiB) Viewed 9957 times

Re: Alexar's Physics Editor(APE)

Posted: Wed Sep 28, 2016 1:59 pm
by Ref
Ever think of putting the following in your library?

Code: Select all

-- note: following requires that 'world' be global
function helper.newBox( t, x, y, w, h, d )	-- type, location, size [,density]
	local d		= d or 1
	local box		= love.physic.newBody( world, x, y, t )
	local shape	= love.physic.newRectangleShape( w, h )
	local fixture	= love.physic.newFixture( box, shape, d )	-- density
	return box
	end
function helper.newCircle( t, x, y, r, d )	-- type, location, radius [,density]
	local d		= d or 1
	local circle	= love.physic.newBody( world, x, y, t )
	local shape	= love.physic.newCircleShape( r )
	local fixture	= love.physic.newFixture( circle, shape, d )
	return circle
	end
function helper.newPolygon( t, x, y, v, d )	-- type, location, relative verts [,density]
	local d		= d or 1
	local poly		= love.physic.newBody( world, x, y, 'dynamic' )
	local shape	= love.physic.newPolygonShape( unpack( v ) )
	local fixture	= love.physic.newFixture( poly, shape, d )
	return poly
	end
function helper.newLine( t, x, y,  ... )	-- type, location, relative verts [,density]
	local d		= d or 1
	local body		= love.physic.newBody( world, x, y, t )
	local shape	= love.physic.newChainShape( false, ... )	-- don't close line
	local fixture	= love.physic.newFixture( body, shape, d )
	return body
	end
Then in main.lua you could do:

Code: Select all

--------------------------- rope -----------------------------
local box		= help.newBox( 'static', 400, 100, 35, 35 )
local circle	= help.newCircle( 'dynamic', 400, 150, 20 )
love.physisc.newRopeJoint( box, circle, 400,100, 400,150, 100 )
Just an idea.

Re: Alexar's Physics Editor(APE)

Posted: Thu Sep 29, 2016 1:09 am
by Alexar
Ref wrote:Ever think of putting the following in your library?
Thank you. but for now the helper works more for an Editor than for code. oh yes, we can use them in the script for bodies as shortcut.

Re: Alexar's Physics Editor(APE)

Posted: Wed Oct 26, 2016 3:07 pm
by Zireael
Alexar, in the gif, are you driving the car or is it the AI? Is the driving thing included in the .love in post #1?

Re: Alexar's Physics Editor(APE)

Posted: Thu Oct 27, 2016 1:03 am
by Alexar
Zireael wrote:Alexar, in the gif, are you driving the car or is it the AI? Is the driving thing included in the .love in post #1?
it uses keyboard control, all interaction functions are in body--userdata. click the wheel and look up the userdata tab, you can see the magic.
all the examples are in the tutorial project. just load the project and switch to the scene.

Re: Alexar's Physics Editor(APE)

Posted: Thu Oct 27, 2016 1:18 pm
by Zireael
I downloaded the .love from first post, and I get tons of "a body escaped Memoizer" errors when trying to test the topdown car example.

Also pressing "Help" in first menu causes a Lua error: bad argument #1 to utf8len (string expected, got table)

Re: Alexar's Physics Editor(APE)

Posted: Fri Oct 28, 2016 12:39 am
by Alexar
Zireael wrote:I downloaded the .love from first post, and I get tons of "a body escaped Memoizer" errors when trying to test the topdown car example.

Also pressing "Help" in first menu causes a Lua error: bad argument #1 to utf8len (string expected, got table)
euh, i will see. but you can find the source code in my git.

Re: Alexar's Physics Editor(APE)

Posted: Mon Nov 14, 2016 8:00 pm
by piotrek75
Fond this problem in util.lua:

Code: Select all

function string.stripfilename(filename)
  print(filename)
    return string.match(filename, ".+\\([^\\]*%.%w+)$") -- *nix system
end
On Linux seems it should be (tested on Manjaro):

Code: Select all

function string.stripfilename(filename)
  print(filename)
    return string.match(filename, ".+/([^\\]*%.%w+)$") -- *nix system
end

Re: Alexar's Physics Editor(APE)

Posted: Mon Nov 14, 2016 11:22 pm
by raidho36
Tells me it can't load incompatible bytecode. Not that there should be any to begin with - I prefer being able to read and modify the source.

Just in case you didn't know: different Lua versions generate different bytecode and more often than not they're incompatible.

Re: Alexar's Physics Editor(APE)

Posted: Tue Nov 15, 2016 12:50 am
by Alexar
raidho36 wrote:Tells me it can't load incompatible bytecode. Not that there should be any to begin with - I prefer being able to read and modify the source.

Just in case you didn't know: different Lua versions generate different bytecode and more often than not they're incompatible.
please loop up the source code on my git. although, it's a mess. ^^