Is it possible to have acceleration breaks? The friction doesn’t apply to my object when I control it with the accelerometer, so when I tilt it forward I need to tilt it backwards alot to make it stop. Is there any way to add breaks to it, or some sort of friction for easier controls? [import]uid: 30185 topic_id: 6197 reply_id: 306197[/import]
bumpty [import]uid: 30185 topic_id: 6197 reply_id: 21519[/import]
Try setting the body’s linearDamping. I am not sure what type of unit it is in, so you might need to experiment to find a value that makes sense. All I know is that the default is 0. [import]uid: 7581 topic_id: 6197 reply_id: 21640[/import]
Yeah I’ve been experimenting with that and I ended up setting it to 25… But this is slowing down the overall speed of the object, I need to set a friction to my object, but the normal friction inside the addBody isn’t working since I’m controlling the object with the accelerometer [import]uid: 30185 topic_id: 6197 reply_id: 21705[/import]
Rather than explicitly changing the object’s position with the accelerometer, you should be changing the physics gravity. [import]uid: 7581 topic_id: 6197 reply_id: 21743[/import]
But I’ve got other objects moving around on screen, can I set them to not be affected by gravity?
And is there a tutorial on how to set that up? I only find tutorials on how to change the objects position [import]uid: 30185 topic_id: 6197 reply_id: 21746[/import]
Actually, you are right. I don’t think it is possible to change the physics gravity, try using body:applyForce() on the body you want to move, using the accelerometer data as the force arguments, and the body’s center position as the point aguments. [import]uid: 7581 topic_id: 6197 reply_id: 21748[/import]
Ah right now I remember why I chose not to change the physics and change the x/y instead. If I change the physics for movement, my object can’t grow or it will start moving slow. And almost all powerups make my object grow… Isn’t there any other way? [import]uid: 30185 topic_id: 6197 reply_id: 21762[/import]