Hello! My dilemma is simple; I a making a game and am stuck. I have been programming C++ for ~1 year and just recently got into OpenGL. My game would be based around planets (small - not anything realistically sized - think Super Mario Galaxy planet sized) but I have no idea how to make a planet. So far, I can generate 3D spheres and things of that nature but I need, for when the character jumps, for the character to fall down to the curvature of the planet accordingly. How would I bind the player to the origin of the sphere so that this happens? I also am having troubles with my camera system. My current viewport system does not curve with the character's movement. If you could provide code or links to where I could learn such skills/techniques, that would be greatly appreciated. Thank you for your time.
-Brennan Riddell
1 Replies - 924 Views - Last Post: 11 November 2012 - 06:42 AM
#1
Generating a planet-esque surface to walk on - using C++ OpenGL
Posted 10 November 2012 - 10:28 PM
Replies To: Generating a planet-esque surface to walk on - using C++ OpenGL
#2
Re: Generating a planet-esque surface to walk on - using C++ OpenGL
Posted 11 November 2012 - 06:42 AM
Quote
for when the character jumps, for the character to fall down to the curvature of the planet accordingly
The curvature of the planet? How large is your character relative to the planet, and how high is he jumping??
From a jumping perspective, curvature of planet is irrelevant, really. You have a plane that represents the ground, and you simply accelerate your character toward the plane.
Quote
My current viewport system does not curve with the character's movement.
You need to transform your eye view appropriately to look at an object. In a 2D view, that's just you positioning the view appropriately. In a 3D view, you need to rotate the camera. If you think of your camera as resting on a plane, with the plane tilted towards the object, then you have keep retilting this plane. You can do this by using cross products to recalculate the plane normal.
You can look at gluLookAt implementations online, or just google for how to point a camera at something. If you understand the matrix operations involved, then the math should make sense.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|