So, I moving forward with my card game, which is no more a game, but a card simulation thanks to the immersive experience enabled by babylonjs
Since I am my own client, I refuse myself nothing, huhu (except that flash death sentence has been declared for 2020).
I was stopped yesterday by some black magic… difficult to provide a pg, but maybe just explaining and pasting some code could be enough to get some hints.
As you can see in the screenshot below, all players played one card and the one who won the turn can start the next one by playing a new card, for the record, in the flash version, there is a short visual timer blocking that next move for a little while to ensure everybody saw what happened.
In that new version, I plan to simulate the end of the timer by animating these four cards as the turn winner would grab them, so there will be different animations applied to each of them, position to group them together a bring them to the winner, rotation to orient them in the same direction AND to flip them on their back.
So, sorry for the looong intro, this is where my issue is happening: I have no problem to animate all these cards in any position axis, but for rotation x is working, y and z are doing EXACTLY the same thing (apparently rotating around the y axis…): I would need z to flip them.
I am currently investigating and what I just discovered is if I comment the rotation of the cards in their setup (which let them wrongly oriented) then I can apply animation rotation in all axis, but as soon as I rotate them during their setup then the problem above reappears…
Some code that I could explain furthermore:
card setup (xAngle = Math.PI/2):
let card3Tapis = new Card(this,1,“cardTest”,this.scene, this.cardWidth, this.cardHeight, this.versoMat);
let c3ZRotAnim = new BABYLON.Animation(
this.scene.beginDirectAnimation(this.cardP3.mesh, [c3XPosAnim, c3ZRotAnim], 0, this.positionResolution, false, 1.0);