I’m trying to write a navigation class to implement my third person character control system. I was inspired by the game Ragnarok Online 2: GOTW. The idea is that when I press the direction buttons, the character turns and moves in the selected direction relative by the camera direction, and not the character itself.
For not to bother with writing a system for handling collision reactions, I used physics with TCastleRigidBody. But for my task this system is too physical. I don’t like how the character skids on turns, bounces off walls, etc.
If I understand the code of TCastleWalkNavigation and TCastleThirdPersonNavigation correctly, these classes implement their own simple physics that cannot be reused in user navigation classes.
Maybe I just misunderstood the situation and there is a way to use simple physics in my navigation classes?
PS: Also, my character and camera has different navigation classes. This is makes so that the camera can be controlled in different ways depending on the context, and the character control is the same.
I reworked my character navigation by using velocity, it became much smoother and clearer. There are some difficulties with maintaining gravity - direct setting of velocity resets the vertical speed received from gravity. I had to save the component of velocity from gravity direction and seems to it work.
PS: Yes, I know, I needs some serious rework for walking animation
Having a physical-based navigation components in CGE is our important TODO, and it has actually been already done by Andrzej Kilijański and now waits for my review + merge for over a year. (I know, way too long! – things take me time, and I know there are things there I’d like to tweak first, e.g. it relies on new TCastleAxis, which I want to extend). See
Indeed, the current TCastleWalkNavigation
and TCastleThirdPersonNavigation
by default use our “own simple physics” (documented as " 13. Old system for collisions and gravity" section of this manual: Physics | Manual | Castle Game Engine ). These are not realistic / really physical.
The TCastleThirdPersonNavigation
has a mode to move using physics, see
This does part of the job, but the new components in PR New physics based first/third person 3d and platformer like modular navigation + input axis and others by and3md · Pull Request #533 · castle-engine/castle-engine · GitHub are better
Once we merge the new components, TCastleWalkNavigation
and TCastleThirdPersonNavigation
will be deprecated.