Collision+Physics* for a 3D Jump'n'Run Game

Started by
1 comment, last by samoan62 7 years, 2 months ago

I'm currently developing a game(finally...). Basically it's going to be a 3D Jump'n'Run game. As I have no experience in that are ​I'm researching the possibilities.

My requirements are:

1) I should be able to model quick and responsive character controller.

2) The character should be able to push other things around (for example crates, rocks). Additionally some (or all) of these object should not rotate.

3) Slopes (almost forgot about them). I'm not sure If I need this but I guess I want to prevent climbing high slopes.

*4) I'm not sure if I want some object to be able to push the player. So this lets say that this is optional.

Currently, as a placeholder I use Bullet Physics, where character implemented as capsule that doesn't rotate, and all obstacles are rigid bodies.

​I kind of wonder if ray casting is a viable solution. It surely will make implementing the character controller a lot easier (I think). Making the player pushing a single object shouldn't be that difficult, but making an object to push another object is probably a bit more complicated, I cannot quite model it in my mind.
​Anyone who has experience with that solution? Any suggestions? Am I missing something?

I additionally I can make the character an ellipsoid, but I do not see much benefit compared with the ray casting solution.

I feel like physics engine is too much for such a thing, but I will automagically make the character controller implementation a nightmare (or will it). I have literally 0 experience with physics engines.

​So every opinions, approaches, links to materials are welcome :)

Advertisement

I would not use ray casting. Sonic the hedgehog implemented full blown physics in assembler to get it right. You have bullet at your disposal, use it! :-) I did not see that bullet limits your ability to animate the character. I use it only from within blender, but there I am allowed to set a position at any frame in the animation (a bit tricky hidden in the scene graph).

In general you should always try and utilize the tools available to you the most you can to avoid reinventing the wheel. Manually handling collisions and responses with ray casting, and other collision tests is hard, and very error prone even if you have a good knowledge of 3D math.

Have you considered using Unity? You could very easily add a number of interactive objects to your scene and a character controller. This class https://docs.unity3d.com/Manual/class-CharacterController.html along with Unity physics can take care of all of your questions above. The collider on your character is lozenge-shaped, similar to an ellipsoid.

In particular for question 3, the CharacterController class has a "Slope Limit" property that will prevent your character from going up inclines that are too steep.

This topic is closed to new replies.

Advertisement