Jump to content
  • Advertisement
Sign in to follow this  
snowfell

code revision and questions

This topic is 3677 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 just reached a check point in my current game system and I needed some professional help to check over my mistakes to make sure I didn't do anything extremely wrong. Now please understand what I have done so far is very very basic stuff but it would be best if I get any issues out of the way because they haunt me in the future. 1. Is the following code correct (I just got finished using coordinates to move where the camera is looking (xto,yto,zto) and I just started to figure out a correct way of setting up a direction system instead)? gluLookAt(cord_x,cord_y+5.0f,cord_z,cord_x-sin(yaw*pi/180),cord_y+5.0f,cord_z+cos(yaw*pi/180),0.0f,1.0f,0.0f); 2. What could I do to add pitch into the equation, using the code above? 3. Is their anything wrong if no where might I place the following physics code (currently I have this code set as a function, is that smart for a physics code?) void InitPhysics(float cord_y) { float speed_y=0; float ground_y=0; if (cord_y > ground_y) { speed_y+=.25; } if (cord_y <= ground_y) { cord_y=ground_y; speed_y=0; } while(cord_y > ground_y) { cord_y-=speed_y; } } 4. What could I do to move some of my codes to a external source (I don't know if I could do the job with a .dll or something else, I need a way of moving drawing functions outside of the main source code and then being able to call them in)? Ah if their is anything else I should know please bring it up, I would like to get as many issues out of the way early as possible.

Share this post


Link to post
Share on other sites
Advertisement
perhaps something like the following

cam_position.x = cam_target.x -( sin( heading_rot ) * cos( pitch_rot ) ) * cam_dist;
cam_position.z = cam_target.z -( cos( heading_rot ) * cos( pitch_rot ) ) * cam_dist;
cam_position.y = cam_target.y -( sin( pitch_rot ) ) * cam_dist;

Share this post


Link to post
Share on other sites
I am having a little trouble how that could be used in gluLookAt (I don't see this working to well for what I am trying to achieve). Any way you can explain?

I am just trying to setup a direction system similar to one of a fps using gluLookAt and some math equations (If I need more then using just these things please inform me).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!