Strange behavior?

Hi,

I am running with physics and having an object with a Pivot joint that I am releasing. I am then trying to add some force to the object, but nothing happens? Do I have to add a delay? Why doesn’t the force affect my object?

  
myPivot:removeSelf()  
myPivot = nil  
  
myObj:applyForce(0,-420,myObj.x,myObj.y)  
  

The object is Dynamic and the force that applies before I add a Pivot, works fine.

Happy X-mas, Joakim [import]uid: 81188 topic_id: 19615 reply_id: 319615[/import]

I just ran this test code quickly (very cobbled together obviously) and it worked fine.

[lua]require ( “physics” )
physics.start()
physics.setGravity( 0, 0 )
physics.setDrawMode ( “hybrid” )

myObj = display.newCircle( 160, 60, 20 )
physics.addBody(myObj)

myObj2 = display.newCircle( 160, 300, 20 )
physics.addBody(myObj2)

myPivot = physics.newJoint( “pivot”, myObj, myObj2, 200,300 )

myObj:applyForce(0,-4,myObj.x,myObj.y)[/lua]

Can you tell me if that also works as expected for you and if not what version of Corona you are using - and provide some sample code?

Peach :slight_smile: [import]uid: 52491 topic_id: 19615 reply_id: 75782[/import]

Hi Peach,

Try the following code without the removal of the join, then try it with that code and you will notice the diffrence.

  
require ( "physics" )  
physics.start()  
physics.setGravity( 0, 18 )  
physics.setDrawMode ( "hybrid" )  
   
myObj = display.newCircle( 160, 60, 20 )  
physics.addBody(myObj,"static")  
   
myObj2 = display.newCircle( 160, 300, 20 )  
physics.addBody(myObj2,"dynamic",{radius = 24, density = 0.1, friction = 0.1, bounce = .1})  
   
myPivot = physics.newJoint( "pivot", myObj, myObj2, 200,300 )  
  
myPivot:removeSelf() --Try with and without and see the difference  
myObj2:applyForce(210,-144,myObj2.x,myObj2.y)  

[import]uid: 81188 topic_id: 19615 reply_id: 75803[/import]

I am running 704 :slight_smile: [import]uid: 81188 topic_id: 19615 reply_id: 75804[/import]

I mean, try with the join created and directly removed. And then try without the joint ever created. In both cases the behavior would be the same? [import]uid: 81188 topic_id: 19615 reply_id: 75809[/import]

I just ran the code and I do notice that if the joint is removed the ball appears to shoot upward and not to the right at all.

Could you file this as a bug report, please?

Peach :slight_smile: [import]uid: 52491 topic_id: 19615 reply_id: 75905[/import]

Peach, where do I do that?

Joakim [import]uid: 81188 topic_id: 19615 reply_id: 75935[/import]

Hey Joakim,

Sorry - that would be here; http://developer.anscamobile.com/content/bug-submission

There is a link in the top right to submit a bug that goes to that link as well.

Peach :slight_smile: [import]uid: 52491 topic_id: 19615 reply_id: 75943[/import]

Bug filed!

Do you have any other idea for “how to” approach this?

I am having a platform game where the player needs to stick to the platform and not glide off due to the physics. And when the player touch the screen, he should jump of the platform. Thats what I was trying to do, by adding a pivot joint.

Joakim [import]uid: 81188 topic_id: 19615 reply_id: 75963[/import]

[SOLVED]

This thread helped me out to create moving platforms within physics.

https://developer.anscamobile.com/forum/2011/07/11/physics-and-moving-platforms

Joakim [import]uid: 81188 topic_id: 19615 reply_id: 75975[/import]