I managed to control my character walking on the ground and jumping using BetterCharacterControl.
My questions are : is it normal that the CollisionShape affected to the character doesn’t rotate when calling control.setViewDirection () ?
When I set setViewDirection, the character only rotates across Y axis, how can we rotate across other axes ?
Yes, that is normal behavior. The collision shape should always be aligned with the gravity vector, and the controlled spatial should only rotate around the gravity vector.
If you want the visible character to be able to rotate around other axis, you can add the BetterCharacterControl to a node, then attach the character spatial to the node. The BetterCharacterControl will force the node to only rotate around the gravity vector, but the character spatial will be free to rotate however you wish.
Yes, but I don’t know if it matches my request, because when my character jumps, I would like to apply to him linear velocity, so that he acts like a rigid body (I missed this detail in my first psot).
Is there a way to switch between two controls for a spatial ? Or should I do like codex said, knowing that I tried but didn’t succed to make it work.
Maybe I could enable/disable the two controls to do the switch ? but I don’t know if it could affect perfoirmances.
You could factor that force into the walk direction. If I remember correctly BetterCharacterControl just sets the xz linear velocity directly from the walk direction.
Alternatively, you could write your own character control from scratch. Since a character is basically a rigid body with angular factors disabled, it isn’t actually as difficult as it may sound. Though, it might be a little overkill for this.