Jump to content
• Advertisement

# Projectile Motion

This topic is 2802 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I'm having a hard time solving this problem

It suppose to create a quadratic motion(like that in Worms or Pocket Tank) and the space between the points should be equal
but i cant manage to get it right.

void quadratic(int angle,int vel) { float theta=3.14*angle/180;//angle to radians ux=vel*cos(theta);//X coord init value uy=vel*sin(theta);//Y coord init value t=((vel*vel)*(2*(sin(theta)*cos(theta))))/9.8;//maximum range that projectile can reach for(i=1;i<=t*2;i++)//nr of projectile (i=time) (t=distance to travel) { x=ux*i;//X coord value y=uy+(i*i*-9.8*0.5);//Y coord value glVertex2f(x/50,y/50); } } void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(-20.0f, 0.0f, -50.0f); glPushMatrix(); glBegin(GL_POINTS); quadratic(45,15); glEnd(); glPopMatrix(); glutSwapBuffers(); }

#### Share this post

##### Share on other sites
Advertisement
Not sure what you are asking, and why/what space should be equal?

#### Share this post

##### Share on other sites

• Advertisement
• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• Advertisement

• ### Popular Now

• 11
• 23
• 38
• 75
• Advertisement
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!