Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-16-2003, 06:41 PM   #1 (permalink)
saline
I am red.
 
saline's Avatar
 
Join Date: Feb 2003
Location: Cleveland, OH
Posts: 139
saline is on a distinguished road
physics

Ok, so here's the deal. I'm just messing around with pyGame, which is a collection of methods and things to use for writing games.

I'm just getting into it so I just wanted to make something that draws a ball and then makes it fall with "real physics action"(TM).

So, I got it to draw the ball and looked up the formula

d = 1/2(a t*t)

in english: distance equals one half of the quantity accelleration multiplied by time squared.

That crazy gallileo...

anyway, the thing I realized after much confusion was that my numbers weren't floats, so they were rounding, no good.

Then I realized further that this equation produces results in meters per second. I was displaying it however in pixels per second.

You will likely see the problem with this. The ball starts out travelling just a little too slow and then it goes way too fast. A little too fast is justifiable because I make no account for air resistance but it's way too fast.

So the question is, how many pixels are in a meter? And further, is this actually going to fix my problem do you think?

Thanks in advance.
__________________
http://home.cwru.edu/~cak19

It's my homepage with odd little bits of javascript.
saline is offline   Reply With Quote
Old 10-17-2003, 02:41 PM   #2 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
Well, In photoshop 2835 pixels = 100 cm


HTH
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 10-18-2003, 11:12 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
Quote:
Originally posted by Ilya020
Well, In photoshop 2835 pixels = 100 cm
it would completely depend on the resolution vs the size of your monitor, so i don't think the conversion could be simply calculated by a measurement such as cm or meters ( in real life ) to pixels.

i bet you could find some pretty cool accelleration/deceleration flash tutorials or actionscript somewhere. that should point you to the right direction for the logic.
__________________
Mike
sde is offline   Reply With Quote
Old 10-18-2003, 05:52 PM   #4 (permalink)
palin
Code Monkey
 
palin's Avatar
 
Join Date: Jan 2003
Posts: 57
palin is on a distinguished road
I think you could just decide how many pixels = a meter or centi meter. Just decided on the scale of your environment then you should be able to figure out how far the obect falls.
palin is offline   Reply With Quote
Old 10-19-2003, 09:16 AM   #5 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
Quote:
Originally posted by sde
it would completely depend on the resolution vs the size of your monitor, so i don't think the conversion could be simply calculated by a measurement such as cm or meters ( in real life ) to pixels.

i bet you could find some pretty cool accelleration/deceleration flash tutorials or actionscript somewhere. that should point you to the right direction for the logic.
LOL, well duh!

:p
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Old 10-19-2003, 02:54 PM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
duh?
__________________
Mike
sde is offline   Reply With Quote
Old 10-19-2003, 02:57 PM   #7 (permalink)
Ilya020
Techno Rat
 
Ilya020's Avatar
 
Join Date: Jan 2003
Location: San Diego
Posts: 559
Ilya020 is on a distinguished road
Send a message via AIM to Ilya020
It was stupid of me not to realize that...
__________________
> SELECT * FROM users WHERE clue > 0
0 rows returned
Ilya020 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 05:12 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting