• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

BobJelly

Help with physics

9 posts in this topic

Hi all ! I want my player to throw an object at an exact location (with a motion along a parabola). The problem is, I need to find the velocity needed... I have the start location, the hit location, the acceleration (only gravity here)... but I also need the time to be able to find the value of the velocity (maybe i''m wrong here) !
  
vHitLocation = vStartLocation + (vVelocity * fTime) + (vGravity * (fTime*fTime) * 0.5f);

vVelocity = ??
  
Do you have any idea on how i could proceed ?
0

Share this post


Link to post
Share on other sites
Hum i forgot something... I know the angle at wich my object is thrown...
  
vHitLocation = vStartLocation + (vDirection * fSpeed * fTime) + (vGravity * (fTime*fTime) * 0.5f);
fSpeed = ??

Much better... Still I don''t know how I could find the value of fTime and fSpeed... they are both dependant one on the other
I''m sure I''m doing something wrong...
0

Share this post


Link to post
Share on other sites
well, I am thinkin about this, do you by any chance know the maximum height this object achieves, b/c if you do then you can calculate air-time, and therefor total time, and therefore velocity.
0

Share this post


Link to post
Share on other sites
Here''s my solution:

The path of a projectile can be modeled by the parametric equtations:

x_coordinate(time) = original_velocity * cos(theta) * time

and

y_coordinate(time) = original_height + (original_velocity * sin(theta)* time) - acceleration_due_to_gravity * time^2

The graph of these equations produces the trajectory of the projectile.

The acceleration due to gravity is based on the measurement system, metric is 9.8 m/(s^2) while english is 16 ft/(s^2).

Assuming you only have two unknowns, and that they appear in both equations, finding those unknowns is a simple matter of substitution.

In the case of BobJelly, all you have to do is substitute the values you know and solve for time, which will be in terms of the original velocity.

Substitution of that value back into the second equation produces a one value equation with the only variable being the original velocity.

The only thing that now remains is the trivial proceeding of solving the second equation for the original velocity and there you go.

That should do just about do it, hope I explained it well enough.

Peace out.
0

Share this post


Link to post
Share on other sites
I'm following the exact approach as Wizardry here. I've derived the final answer so you don't have to do as much work.

Lets see, you *know* the following:

start (throw) position (x0, y0)
end (hit) position (x1, y1)
lets say x is positive to the right, y positive up.
start angle, call it theta0 (in radians), measured from horizontal
gravity (-g in y direction)

You want to find the following:

tv = throwing velocity
th = time of hit

Your projectile motion path is given by these two scalar equations:


x(t) = x0 + tv*cos(theta0)*t
y(t) = y0 + tv*sin(theta0)*t - g*t*t/2


Of course, you could write it as the two vector equations, with x acceleration component being 0.

The time, t, is measured from the time of the throw---so that the time of the throw is t = 0.

At the time of hitting your target, (time = th), you have


x(th) = x1 = x0 + tv*cos(theta0)*th
y(th) = y1 = y0 + tv*sin(theta0)*th - g*th*th/2


There are two unknowns, th and tv. You have to solve the last two equations simulataneously. Start by solving the first equation for tv:


tv = (x1-x0)/(th*cos(theta0))


Then rewrite the second equation


y1 = y0 + (x1-x0)*sin(theta0)*th/(th*cos(theta0)) - g*th*th/2


Simplifying (note that th drops out of second term and
sin/cos = tan),


y1 = y0 + (x1-x0)*tan(theta0) - g*th*th/2


Or,


g*th*th/2 = y0-y1 + (x1-x0)*tan(theta0)


Solving for th,


th = sqrt((2/g) * (y0-y1 + (x1-x0)*tan(theta0)))


Take the positive square root since negative time isn't physically consistent here. If the discreminant of the sqrt term is negative then it means you *cannot* hit the target for the given throwing angle (i.e., you cannot hit a target at a higher position if object is thrown horizontally).

Then, from the earlier equation


tv = (x1-x0)/(th*cos(theta0))



Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Edited by - grhodes_at_work on June 29, 2001 4:26:56 PM
0

Share this post


Link to post
Share on other sites
Found a couple of inconsistencies in Wizardry''s post:

quote:
Original post by Wizardry
y_coordinate(time) = original_height + (original_velocity * sin(theta)* time) - acceleration_due_to_gravity * time^2



You need to divide your last term by 2 so that:

y_coordinate(time) = original_height + (original_velocity * sin(theta)* time) - (acceleration_due_to_gravity * time^2)/2


quote:
Original post by Wizardry
The acceleration due to gravity is based on the measurement system, metric is 9.8 m/(s^2) while english is 16 ft/(s^2).



Actually, in English units its roughly 32 ft/(s^2), .

quote:
Original post by Wizardry
Peace out.



Yes, peace.


Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
0

Share this post


Link to post
Share on other sites
quote:
Original post by python_regious
What do you mean by "English" units? We use metric in Britain.


Oops. I'm using the phrase "English Units" as we use it in America. Really it is the "U.S. Customary System of Units," which uses the avoidupois system of weights. Its related to the British Imperial system. When you really get down to it this is a bit complicated! The web page below provides some details, I guess:

http://www.encyclopedia.com/printablenew/04129.html

Anyway, regardless of the fact that you use the Metric system in Britain, apparently the phrase "English Units" refers always to use use of pounds, ounces, tons for weight, pound-force for force, foot per second squared for acceleration, inch, foot, yard for distance, etc. The thing that has changed over time is that now the basic "English" units are now actually defined in *terms* of Metric units (e.g., a yard is now defined to be some fractional number of meters) when they used to be defined some other way. Its strange. Here is a web page that compares the units of English and Metric units.

http://www.essex1.com/people/speer/units.html

This was actually a fairly fascinating question! I did some searching to reply, and I may still have some things wrong. I certainly hope you didn't take offense in my original post----I believe I did use the term correctly.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Edited by - grhodes_at_work on June 29, 2001 7:19:46 PM
0

Share this post


Link to post
Share on other sites
No offense taken We usually call that the imperial system, it''s the first time I''ve heard it called the english system...
0

Share this post


Link to post
Share on other sites
Growing up in a former British colony, we were taught both the Imperial and Metric systems, and familiarized with both the terms "Imperial" and "English". Funny the British don''t teach that, since our curriculum is modeled exactly after the British (we even accept London and Cambridge GCEs).
0

Share this post


Link to post
Share on other sites