Physics Bullets Momentarily Breaks Joint Weld

I have a fast moving physics object set as a bullet.  The problem occurs when the object collides at a speed great enough where it would normally pass through if mybody.isBullet did not equal true.  When it collides with the wall the wall momentarily (on one frame) breaks its weld with the center piece.  However on the next frame the wall reestablishes its weld.  

It takes a sharp eye to notice and it is only an aesthetics problem the physics of the game behaves as it should.

[lua]

display.setStatusBar( display.HiddenStatusBar )

require “physics”

physics.start()

physics.setDrawMode(“normal”)

physics.setGravity(0,0)

–components

center = display.newCircle(50,50,50)

center.x = 320

center.y = 480

physics.addBody(center, “kinematic”,{ radius=50})

blade_HORI_Sensor = display.newRect(200,15,250,20)

blade_HORI_Sensor:setFillColor(200,0,0)

blade_HORI_Sensor.x = 320-125;         blade_HORI_Sensor.y = 470

physics.addBody(blade_HORI_Sensor, “dynamic”,{ bounce = 1})

blade_HORI_Wall = display.newRect(200,15,250,20)

blade_HORI_Wall:setFillColor(0,200,200)

blade_HORI_Wall.x = 320-125;         blade_HORI_Wall.y = 490

physics.addBody(blade_HORI_Wall, “dynamic”,{ bounce=1})

blade_HORI_Tip = display.newCircle(320-250,480,20)

blade_HORI_Tip:setFillColor(0,200,200)

physics.addBody(blade_HORI_Tip, “dynamic”,{ radius=20})

physics.newJoint( “weld”, center, blade_HORI_Sensor, 320, 480 )

physics.newJoint( “weld”, center, blade_HORI_Wall, 320, 480 )

physics.newJoint( “weld”, center, blade_HORI_Tip, 320, 480 )

center.angularVelocity = 300

gameBall = display.newCircle(400,150,16)

physics.addBody( gameBall, “dynamic”,{radius = 16, bounce = 0})

gameBall.isBullet = true

gameBall:setLinearVelocity( -1000, 1000 )[/lua]

Hi @DCbball4life,

Can you construct this “wall” object using multiple body parts, instead of separate physics bodies attached by weld joints? Those are inherently rock-solid stable, so they should be used unless there’s a reason why they can’t.

Thanks,

Brent

I guess I thought that’s what I was doing.

For anyone else here’s how you construct objects with multiple body parts:

http://www.coronalabs.com/blog/2013/01/08/working-with-multi-element-physics-bodies/

So just curious then when would you use a weld?

Hi @DCbball4life,

Weld joints are useful for different situations, like when you need to attach two physics bodies with different settings/type/behavior/filters, or “weld” one object to another in run-time when they weren’t previously attached (for example, a fired arrow sticking to a wall). You can see this application in my “Sticky Projectiles” demo: http://www.coronalabs.com/blog/2013/02/19/more-physics-tricks-explained/

Remember that weld joints, while “solid”, are not 100% solid. Under more extreme circumstances, they can flex and bend a bit.

Brent

Alright great thanks for the response.  One last thing I made my windmill like you suggest but it wont react to the collision.

[lua]

display.setStatusBar( display.HiddenStatusBar )

require “physics”

physics.start()

physics.setDrawMode(“hybrid”)

physics.setGravity(0,0)

local windmill = display.newCircle(320,480,10)

windmill.x, windmill.y = display.contentWidth/2, display.contentHeight/2-200

local blade1 = {-37.4166,65, -17.5,60, 2.5,40, 10,20, 10,0,}

physics.addBody(windmill, “kinematic”, 

  {shape=blade1}

  )

windmill.angularVelocity = -600

gameBall = display.newCircle(600,display.contentHeight/2-200,16)

physics.addBody( gameBall, “dynamic”,{radius = 16, bounce = 1})

gameBall.isBullet = true

gameBall:setLinearVelocity( -200, 0 )[/lua]

Hello again,

Looks like you’ve broken some rules in the shape creation; specifically it looks like you’re declaring the coordinates in counter-clockwise order. They must be declared going around in clockwise order, otherwise the body collision will break.

Brent

Hi @DCbball4life,

Can you construct this “wall” object using multiple body parts, instead of separate physics bodies attached by weld joints? Those are inherently rock-solid stable, so they should be used unless there’s a reason why they can’t.

Thanks,

Brent

I guess I thought that’s what I was doing.

For anyone else here’s how you construct objects with multiple body parts:

http://www.coronalabs.com/blog/2013/01/08/working-with-multi-element-physics-bodies/

So just curious then when would you use a weld?

Hi @DCbball4life,

Weld joints are useful for different situations, like when you need to attach two physics bodies with different settings/type/behavior/filters, or “weld” one object to another in run-time when they weren’t previously attached (for example, a fired arrow sticking to a wall). You can see this application in my “Sticky Projectiles” demo: http://www.coronalabs.com/blog/2013/02/19/more-physics-tricks-explained/

Remember that weld joints, while “solid”, are not 100% solid. Under more extreme circumstances, they can flex and bend a bit.

Brent

Alright great thanks for the response.  One last thing I made my windmill like you suggest but it wont react to the collision.

[lua]

display.setStatusBar( display.HiddenStatusBar )

require “physics”

physics.start()

physics.setDrawMode(“hybrid”)

physics.setGravity(0,0)

local windmill = display.newCircle(320,480,10)

windmill.x, windmill.y = display.contentWidth/2, display.contentHeight/2-200

local blade1 = {-37.4166,65, -17.5,60, 2.5,40, 10,20, 10,0,}

physics.addBody(windmill, “kinematic”, 

  {shape=blade1}

  )

windmill.angularVelocity = -600

gameBall = display.newCircle(600,display.contentHeight/2-200,16)

physics.addBody( gameBall, “dynamic”,{radius = 16, bounce = 1})

gameBall.isBullet = true

gameBall:setLinearVelocity( -200, 0 )[/lua]

Hello again,

Looks like you’ve broken some rules in the shape creation; specifically it looks like you’re declaring the coordinates in counter-clockwise order. They must be declared going around in clockwise order, otherwise the body collision will break.

Brent