Hi BEPU,
I am making a voxel game in which the player should be able to walk on walls, ceiling and so on. Is there a way for the CharacterController to do so?
Thanks beforehand!
Dechcaudron
CharacterController supporting different orientations
-
- Posts: 7
- Joined: Thu Jul 10, 2014 8:52 am
Re: CharacterController supporting different orientations
Yup; set the CharacterController.Down such that it points to the current 'floor'.
Check out the PlanetDemo for an example of its usage. As the character walks around the planet, its feet always point towards the center.
Note that changing the down direction is an instant, unchecked effect. When using a rotationally variant shape like a cylinder (which the CharacterController uses), rotating 90 degrees instantly could cause it to deeply intersect the environment. In the worst case, the character might not even fit with its new orientation. If that turns out to be a problem, either check the volume that the character will occupy before swapping orientation or use a rotationally invariant shape for the character, as in the SphereCharacterController.
(It's also possible to use constraints to control orientation rather than teleportation. The regular dynamic simulation would stop the character from rotating into invalid states. However, to get the benefit of this sort of approach, the logic controlling the orientation would get complicated. It may be worth it in a game where physical consistency is extremely important- I did it in a people-with-magnetic-boots-on-dynamic-spaceships-game where the movement of people correctly affected the movement of the ships and vice versa, for example- but otherwise it's probably more work than it's worth.)
Check out the PlanetDemo for an example of its usage. As the character walks around the planet, its feet always point towards the center.
Note that changing the down direction is an instant, unchecked effect. When using a rotationally variant shape like a cylinder (which the CharacterController uses), rotating 90 degrees instantly could cause it to deeply intersect the environment. In the worst case, the character might not even fit with its new orientation. If that turns out to be a problem, either check the volume that the character will occupy before swapping orientation or use a rotationally invariant shape for the character, as in the SphereCharacterController.
(It's also possible to use constraints to control orientation rather than teleportation. The regular dynamic simulation would stop the character from rotating into invalid states. However, to get the benefit of this sort of approach, the logic controlling the orientation would get complicated. It may be worth it in a game where physical consistency is extremely important- I did it in a people-with-magnetic-boots-on-dynamic-spaceships-game where the movement of people correctly affected the movement of the ships and vice versa, for example- but otherwise it's probably more work than it's worth.)
-
- Posts: 7
- Joined: Thu Jul 10, 2014 8:52 am
Re: CharacterController supporting different orientations
Hi Norbo,
I've read over here that you are awesome. Thank you for your time and effort, for your help, and for making this possible. You deserve a special throne in the video game community
Regards,
Dechcaudron
I've read over here that you are awesome. Thank you for your time and effort, for your help, and for making this possible. You deserve a special throne in the video game community

Regards,
Dechcaudron