Jump to content

  • Log In with Google      Sign In   
  • Create Account

Need help with camera view keeping charactor object in view


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 sha1962   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 09:11 AM

Really need some help, have started opengl, I Have created object loader, Gameloop, collision routine.s etc, But I am stumped on how to keep the main charactor object in view, for instance when it goes behind a wall or a part of the terrain that is closer.

Sponsor:

#2 JTippetts   Moderators   -  Reputation: 8508

Like
0Likes
Like

Posted 15 April 2012 - 10:18 AM

Do a ray test from the point within the main character object that is the center of the camera's focus (its head, its feet, wherever you point the camera at) to the location of the camera if it is allowed to be at its furthest distance (ie, no occlusion). If an intersection with blocking geometry is tested, snap the camera to the point of intersection nearest to the character; otherwise, the camera may be allowed to translate out to its furthest distance, either instantly or with over-time motion to reduce the disorienting snapping of the camera.

#3 sha1962   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 10:52 AM

Thank you for the quick response, have you any suggestions of books to read up on Ray test

#4 JTippetts   Moderators   -  Reputation: 8508

Like
0Likes
Like

Posted 15 April 2012 - 02:15 PM

Just about any 3D primer or text, or any of several thousand page hits on google for 3D ray intersection or ray hit testing. Many third-party APIs such as Ogre, Urho3D, Irrlicht, etc... will have ray testing capabilities built in. You could check their implementations out if you desire.

The basics of it are that you construct a ray (remember, a ray is a portion of a line segment starting at a point an extending in one direction to infinity) then calculate intersections of that ray with the various quads and triangles of your world geometry. The math is relatively simple, but the actual details of it will depend a great deal on the overall structure of your scene.

#5 sha1962   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 02:38 PM

thanks a gain, i allready do a collision test with world to get height, wikk have to read and adapt, i have been doing a lot of reading, hardest part is getting my head around it , now i realize i have to do another sort of collision test, many thanks just needed a point in the right direction.

#6 sha1962   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 03:37 PM

forgot to mention i program in delphi and not much info out there.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS