Crystal Space
Welcome, Guest. Please login or register.
November 19, 2017, 10:34:03 pm

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80472 Members
Latest Member: Markdotolo2564
* Home Help Search Login Register
+  Crystal Space
|-+  Miscellaneous
| |-+  Article/Tutorial Requests
| | |-+  Collision Detection specifically for 3rd person view
« previous next »
Pages: [1] Print
Author Topic: Collision Detection specifically for 3rd person view  (Read 5704 times)
Posts: 40

View Profile WWW
« on: May 11, 2005, 03:49:41 am »

A tutorial/article on collision detection would be really nice.  I've read through the documentation and various examples, and I even tried to implement it using walktest's code.  However, I cannot get it to work, and I am still pretty confused as to how it works in general.

Edit: Sorry, I forgot to mention that I would prefer a 3rd-person view tutorial.  The walktest collision detection code assumes a first-person view and it's hard enough to understand what they're trying to do with this approach, let alone know what to change in order to make it work for a third-person view.
Posts: 4

View Profile
« Reply #1 on: October 12, 2005, 06:53:21 pm »

Although it doesn't turn out to be a step-by-step tutorial, I hope those pointers may help along:

3rd person view means that the camera is centered on the actor character as it is moving through the world.

The main concerns are, in that order
  • That the actor doesn't walk through obstacles
  • Have the camera follow the actor
  • That the camera view isn't cluttered by some object

The first item on the list should be fairly easy to handle - bind the collider_actor to the acting object in question instead to the camera. Having that done you should come up with a fixed-view camera and the actor moving around the world space respecting any possible collisions.

Next comes the camera movement.
There are different ways to have the camera bound to a certain object. The easiest would be to periodically read the position and bearing of the object, add a certain vector and angle and have the camera position and bearing set with these values.

Last comes the method how to keep the field of view free from any obstacles.
As one could see in different games there are different ways to achieve this goal, ranging from moving the camera nearer to the actor, past the obstacle, rotating the camera around the actor or simply not drawing the obstacle or making it transparent.
The easiest way would be to do a TraceBeam() between the actor and the intended camera position (mind the direction of the beam - actor to camera) - it catches any object which sits right in the middle of the field of view between the camera and the actor as well as the position where the beam hits the first object on its way into the camera. Placing the camera in front of that given position should be a piece of cake in that case.
Full Member
Posts: 122

View Profile Email
« Reply #2 on: October 13, 2005, 12:50:33 am »

As a sort of non-answer, you could always use CEL, which handles collision detection in multiple camera views (third, first, lara, etc.) and you don't have to mess with camera transformations just to move a character.  And, as a question to Jorrit more than anything, is walktest even meant for a template or something to base code off?  Last time I checked the code inside walktest stated that it should not be used for your own projects.   
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 9.247 seconds with 18 queries.