I need help

Monkey Forums/Monkey Beginners/I need help

Nicolas(Posted 2014) [#1]
How can I make a ball roll from angle shape.

yiotoo(Posted 2014) [#2]
with rotate()
try this: http://www.monkeycoder.co.nz/Community/posts.php?topic=7953&post=79239
put the images in the folder: nameofyourproject.data

Nicolas(Posted 2014) [#3]
Hmm I'm talking about the ball is moving downhill.

Gerry Quinn(Posted 2014) [#4]
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.]

Paul - Taiphoz(Posted 2014) [#5]
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....

Gerry Quinn(Posted 2014) [#6]
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 )

Nicolas(Posted 2014) [#7]
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 :)

Nicolas(Posted 2014) [#8]
Like this guys : https://www.youtube.com/watch?v=0awh5MFJwQo .

Gerry Quinn(Posted 2014) [#9]
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.

Nicolas(Posted 2014) [#10]
Hi Gerry,

But how? Should I attach the object first to box2d and not to make it move? but how?