Hi,
I was making a game and wanted to use joints, but adding joints causes increase in the mass of the main object and the main object tilts to its side coz of the added mass.
My usecase goes like this,
i have a horizontal wooden plank in a free fall, i have added a spike using weld joint to its left, when i add a spike the wooden plank is falling sidewards because of increase in the mass, i tried making the spike density to zero with no luck, is there a way to make the plank fall uniformly with joints to other objects.
my code:
main.lua
display.setStatusBar( display.HiddenStatusBar ) local physics = require( "physics" ) physics.start() -- physics.setDrawMode( "hybrid" ) display.setDefault( "background", 0, 0, 0) ------------------------------------------------------------ local plank = display.newRect( 0,0,display.contentWidth,40 ) plank.x = display.contentCenterX plank.y = 0 plank:setFillColor( 219/255, 112/255, 147/255 ) physics.addBody( plank, "dynamic", {isSensor = true} ) plank.gravityScale = 0.7 ----------------------------------------------------------------------------- local spikeVertices = {100,25,50,25,75,100} local SpikeGrp = display.newGroup() local numVertices = plank.width/10 for i=0,2 do local spike = display.newPolygon(numVertices\*i,30,spikeVertices) spike:setFillColor(219/255, 112/255, 147/255 ) physics.addBody( spike, "dynamic", {isSensor = true, density = 0 } ) local weldJoint = physics.newJoint( "weld", plank, spike,numVertices\*i, 0 ) weldJoint.dampingRatio = 1 spike.joint = weldJoint SpikeGrp:insert(spike) end
attached screenshot for reference
TIA,
Nischal Y