Mes connaissances naissantes de java couplées à mon petit niveau d’anglais me pose un problème.
Sur un bouquin que j'essais de suivre, jusque ici, tout allais bien, mais la, je butte sur le point suivant :
"
To find the actual direction of rotation, we subtract the character orientation from the target
and convert the result into the range (−PI, PI) radians. We perform the conversion by adding or
subtracting some multiple of 2PI to bring the result into the given range. We can calculate the
multiple to use by using the mod function and a little jiggling about.
"
Point d'autres explications.
Le tout début, très simple :
float rotation = target.getOrientation() - character.getOrientation();
ensuite, convert the result into the range (−PI, PI) radians
je n'ai pas idée de la manière de le faire.
le pseudocode indique
1 2
| # Map the result to the (-pi, pi) interval
rotation = mapToRange(rotation) |
Mais ce qu'il y a derrière ce mapToRange () ...
Quelqu'un a t'il quelques pistes ?
Partager