Page 1 of 1

Need help with physics on a Maze project.

Posted: Thu Apr 28, 2011 12:41 am
by Gid13
Me and a few friends started on a maze project and we have just about everything but 2 things. First we are missing collisions between the player and the maze. Second, we can't get the camera to be a little above the player and follow him. How can we apply your physic engine and make collisions with the player moving?

I uploaded the project here since it has so many classes.
http://hotfile.com/dl/116016358/09afd39/Maze.zip.html

Examples of code to make collisions would be helpful.

Re: Need help with physics on a Maze project.

Posted: Thu Apr 28, 2011 12:53 am
by Norbo
Using the SimpleCharacterController from the BEPUphysicsDemos would work for player control and collisions. You could give your level geometry to a StaticMesh, add it to the space, then drop a SimpleCharacterController on it. To position your camera, you can just use the character body's position offset by a little up or something.

The BEPUphysicsDemos project shows an example implementation of this. You can download it from the main source repository or the latest development build: http://bepuphysics.codeplex.com/SourceC ... evelopment

Re: Need help with physics on a Maze project.

Posted: Thu Apr 28, 2011 1:45 am
by Gid13
Any examples of code of how would I link the SimpleCharacterController to my current maze project because the models are just loaded by the content.Load<Model>(); and most of the examples I see on this site have models outputted to different classes.

Re: Need help with physics on a Maze project.

Posted: Thu Apr 28, 2011 2:10 am
by Norbo
For the character controller, search the BEPUphysicsDemos project for the SimpleCharacterController, SimpleCharacterControllerInput, and the StandardDemo. StandardDemo creates a SimpleCharacterControllerInput, which manages input and tells a SimpleCharacterController how to move.

For the meshes, check out the StaticMeshDemo. You can extract vertices from a model and give them to a StaticMesh.

The getting started documentation may help figuring out the basics as well: http://bepuphysics.codeplex.com/wikipag ... umentation