# Thread: normal path for a ball

1. ## normal path for a ball

Dears
I want to move a ball from (x1,y1) to (x2,y2). but I need to ball's path look likes noram path same as real world,

also there are different LCDs in nokia phones.
I don't know how will I change the ball's x,y for moving from x1,y1, to x2,y2.

Saeed.

2. ## Re: normal path for a ball

What do you mean by normal? Parabolic curve (like throwing a ball)? Or friction slowing down a ball rolling on a surface?

It is possible to calculate the real world pysics in to the equation, it is just matter of what you are trying to achieve...

Hartti

3. ## Re: normal path for a ball

I don't know what you want to do, but I have successfully done a tennis ball animation on mobile, which very close to real world animation.

1. Take a ball in 3D space
2. Apply diff. forces on the ball
3. Find out velocity and update position of ball
4. Take a projection to 2D space (viewport)
5. Display the ball on projected co-ordinates.

Hope this helps.

4. ## Re: normal path for a ball

if the ball is thrown you can calculate the balls positions for a given time after start and a given strength (means a starting velocity) and a given alpha (starting angle counterwise beginning at 3 o'clock) with the following equation

x = strength * time * cos(alpha)
y = -(g/2) * t * t + strength * time * sin(alpha)

keep in mind that operating at pixels in steps (time) can result in a very different new position (delta is bigger than recognizable, e.g. ball jumps out of the view) or very small delta (smaller than 1 pixel, so that the movement is not recognizable too). use a clever time base - time step combination to avoid these.

keep in mind that midp 2.0 doesn't know floats, you have to hardly work around this fact for a midp 1.0 device

regards ray()

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•