how to stop sliding physics object ?

Hi all,

I am trying to have object drooping on a wall  and then move it using translate as per event until the end of the wall. The issue i am facing that when I create the object and place it on the wall/rope it starts to slide. 

I want it to be idle and the user should move it because i am using walk animation. i tried to play with friction but no luck.

the code is follows for both object and the rope …

the object 

[lua]

physics.addBody( obj,{ density=3, friction=0, bounce=0 } )

[/lua]

the wall 

[lua]

physics.addBody( wall, { density=1, friction=0, bounce=0 } )

[/lua]

Regards

Abdulaziz

Hi @Abdulaziz,

Is your game using a gravity effect? If so, you can change the object’s gravity scale to 0 until a certain event occurs, so it “floats” in place.

http://docs.coronalabs.com/api/type/Body/gravityScale.html

Brent

Hi Brent,

I tired that but it does not work as I expect. the character is still sliding and when I move it using the sprite image ( walk frames), it falls down or it slides … I want the character to land on the rope and then I move it by an event until it reaches the end of the rope.

I might be doing something wrong.

let me ask in another way : normally if you want to make the character walk or jump , do you make it as physics object and then move it using the sprite sheet ? or just make it as normal display image from sprite sheet ?

Regards
Abdulaziz

Idea: maybe the rope should be a sensor object. Then when your player collides with the rope you move him (via transition or whatever) to the end of the rope.

You could also disable the players physics body during the movement if needed, then turn it back on when he is off the rope.

Just an idea, but one that makes sense if the game moves the player during this event.

Hi Gremlin

Thanks for idea , I will try… the idea is the player will answer question, if the answer is correct the character will move few steps using transition.to for about 50 px until it reach the end of the way on the rope. At the end there is a gift, if the character hits the gift, I will know he reaches the end and then he wins that level.

I am confused here because I did not try to use in my previous projects and I am experimenting this. I think you are idea to stop the physic because that might prevent the character from sliding.

Thanks

Abdulaziz

Hi @Abdulaziz,

Is your game using a gravity effect? If so, you can change the object’s gravity scale to 0 until a certain event occurs, so it “floats” in place.

http://docs.coronalabs.com/api/type/Body/gravityScale.html

Brent

Hi Brent,

I tired that but it does not work as I expect. the character is still sliding and when I move it using the sprite image ( walk frames), it falls down or it slides … I want the character to land on the rope and then I move it by an event until it reaches the end of the rope.

I might be doing something wrong.

let me ask in another way : normally if you want to make the character walk or jump , do you make it as physics object and then move it using the sprite sheet ? or just make it as normal display image from sprite sheet ?

Regards
Abdulaziz

Idea: maybe the rope should be a sensor object. Then when your player collides with the rope you move him (via transition or whatever) to the end of the rope.

You could also disable the players physics body during the movement if needed, then turn it back on when he is off the rope.

Just an idea, but one that makes sense if the game moves the player during this event.

Hi Gremlin

Thanks for idea , I will try… the idea is the player will answer question, if the answer is correct the character will move few steps using transition.to for about 50 px until it reach the end of the way on the rope. At the end there is a gift, if the character hits the gift, I will know he reaches the end and then he wins that level.

I am confused here because I did not try to use in my previous projects and I am experimenting this. I think you are idea to stop the physic because that might prevent the character from sliding.

Thanks

Abdulaziz