• 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.

asdfasdf

Vector addition

6 posts in this topic

Alright, let me start off by saying...I suck at physics. That said, I have a flying object with a constant velocity. Once this object is "shot" i need it to fall realistically.
      
the object vector 
(m = the magnitude of the vector, A = angle of the vector)


and a gravity vector 
(Gm, GA)
  
  

the part i'm having trouble finding is the new angle 
it is much larger than it should be.
I'm betting i'm doing something really stupid.

            
GravityXY.x = Gm * sin(GA) ;
GravityXY.y = Gm * cos(GA) ;


XYVelocity.x = m * sin(A) ;
XYVelocity.y = m * cos(A) ;

ResultantMagnitude = sqrt( pow(XYVelocity.x + GravityXY.x, 2)  + pow(XYVelocity.y + GravityXY.y, 2)   ) ;

ResultantAngle = atan( ( (XYVelocity.x + GravityXY.x) / (XYVelocity.y + GravityXY.y) ) ) ;
      
thats basically my code ( edited for aesthetics ) Once again, physics confuses me SO PLEASE DON"T FLAME AND/OR RIDICULE ME. Edited by - asdfasdf on June 29, 2001 4:46:10 PM Edited by - asdfasdf on June 29, 2001 4:47:17 PM
0

Share this post


Link to post
Share on other sites
instead of using sin and cos functions, (which you can) why don''t you have an exponential type of function that falls realistically. since I suck aat physics, I''d have a counter, then enter the counter number (based on a timer) into my exponential function and find how much it should fall. have a real physics guy tell you how they''d do it.

HHSDrum@yahoo.com
Polarisoft Home Page
0

Share this post


Link to post
Share on other sites
You could just have a gravity vector, and add that to the other vector to get a resultant vector that you should move the object by. Since the path of a moving falling object is a parabola, a parametric equation might be of some benefit here.
0

Share this post


Link to post
Share on other sites
i''d suggest you''re doing it wrong. if your object is to fall realistically, it doesn''t have constant velocity.

stick with cartesian coordinates and only figure out angles when you need ''em for something. for your object, keep a position vector ( pos_x , pos_y , pos_z ) and a velocity vector ( vel_x , vel_y , vel_z ). if you use the coordinate system as oriented in grady''s .gif, your acceleration vector (w/o wind resistance) will be ( 0.0 , -9.8 , 0.0 ) [for ( acc_x , acc_y , acc_z ) that is.]

now, to make it realistic, put in wind resistance. you can approximate it with
F_wind = -c*vel^2 where c is some constant and the (-) sign means that the force on the object is opposite the direction of v (F_wind and vel are vectors here). Once you figure out F_wind_x , F_wind_y , and F_wind_z , you can divide each of those by the mass of the object to get the components of acceleration and add those into ( acc_x , acc_y , acc_z ).
0

Share this post


Link to post
Share on other sites
If you have a starting velocity and an acceleration here''s an equaiton you might find useful.

s = (Vi * t) + 0.5 * a * t^2

''s'' is the displacement of an object from its starting point ''t'' seconds after it started off with ''Vi'' velocity and was influenced by ''a'' acceleration.
0

Share this post


Link to post
Share on other sites
just do this:

struct Vector
{
float x, y;
};

Vector object_vel;
Vector object_pos;
Vector gravity;

void Launch_Object(Vector pos, float angle, float speed)
{
object_pos.x = pos.x;
object_pos.y = pos.y;
object_vel.x = sin(angle) * speed; // If this doesn''t work
object_vel.y = cos(angle) * speed; // then flip cos/sin
}

void Update_Object()
{
object_pos.x += object_vel.x;
object_pos.y += object_vel.y;
object_vel.x += gravity.x;
object_vel.y += gravity.y;
}

void main()
{
Vector v = {0, 0};
Launch_Object(v, .5, .5);
while(you_want_to_keep_moving_your_object)
{
Update_Object();
Draw_Object();
}
}

thats just psuedo-normal code, so it won''t compile, but that should give you an idea...
0

Share this post


Link to post
Share on other sites