I need help
Monkey Forums/Monkey Beginners/I need help
| ||
How can I make a ball roll from angle shape. |
| ||
with rotate() try this: http://www.monkeycoder.co.nz/Community/posts.php?topic=7953&post=79239 put the images in the folder: nameofyourproject.data |
| ||
Hmm I'm talking about the ball is moving downhill. |
| ||
Two options: (1) Learn basic Newtonian physics and trig (2 ) Learn Box2D With regard to physics, the Newtonian interpretation of a ball on an inclined plane is that it is subject to two forces: a gravitational force pointing down, and a reaction force pointing perpendicularly to the plane, sufficient to stop it falling through the plane. Adding these, you get a net force downwards parallel to the plane, with the strength depending on the steepness of the angle. From energy considerations, we can see that the net force is g * Sin( angle ), where the angle is the difference of the plane from the horizontal. This can be converted to an acceleration along the plane. [A real ball would have effects due to angular momentum, but this can be ignored in most situations involving inclined planes. It would be important in a snooker sim etc.] |
| ||
The simple solution is to set the balls rotation to its x velocity, if your moving the ball with something like ball.x+=ball.velx*speed then yeah just set the rotation segment of draw image to the velocity this will rotate the ball the direction it's rolling.... |
| ||
Ah okay, he is trying to make it roll. I would turn it through the angle corresponding to the distance it has rolled. E.g. if the ball is one unit in radius, its circumferernce is 2 * PI, and if it has rolled a distance of 4, the angle is changed by 360 * 4 / ( 2 * PI ) |
| ||
I've been trying to make a path for my ball to roll in box2D. The only option that I see is the CreateBox and CreateCircle. I need a basic info guys :) |
| ||
Like this guys : https://www.youtube.com/watch?v=0awh5MFJwQo . |
| ||
Ah, that reminds me of the old classic Elastomania! You'll need to create the track as well. Maybe as a series of rectangular objects that can't move themselves. |
| ||
Hi Gerry, But how? Should I attach the object first to box2d and not to make it move? but how? |