# Projectile Motion

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

## 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 on other sites
Not sure what you are asking, and why/what space should be equal?

1. 1
2. 2
Rutin
15
3. 3
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633730
• Total Posts
3013580
×