Je suis en train de jouer avec les Splines et les NodeAnimations, et c'est une fonctionnalité plutôt sympa...
...Sauf que je n'arrive pas à faire marcher les rotations.

Dans l'exemple ci-dessous, j'ai juste deux "nodes", sans déplacement, pour faire tourner un cube sur lui-même de 180° (avec le flag "LinearRotation" de base). Là, je m'attendrais à ce que le cube tourne progressivement jusqu'à atteindre 180° à la fin de l'animation.
Or, ce n'est pas du tout le cas: le cube tourne de 20°, revient à zéro, puis repart jusqu'à 160° avant de passer brusquement à -180° sur la fin.

J'aurais tendance à me dire que je n'ai pas compris comment ça marche, mais comme le code fonctionne normalement si la rotation demandée reste inférieure ou égale à 179°, je soupçonne également un problème dans la commande PB elle-même (genre: "180° est considéré comme identique à 0°")...

Pouvez-vous me dire ce que vous en pensez avant que je poste le rapport de bug dans le forum anglais, s'il vous plaît?
Code : Tout sélectionner
;- Init
InitEngine3D()
InitSprite()
InitKeyboard()
;- Window & screen
OpenWindow(0,0,0,800,600,"NodeAnimation Rotation")
OpenWindowedScreen(WindowID(0),0,0,800,600,0, 0, 0,#PB_Screen_SmartSynchronization)
;- Camera
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,10)
;- Node and cube creation
CreateNode(0)
cubeEntity = CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),#PB_Material_None)
AttachNodeObject(0,EntityID(cubeEntity))
;- Animation: 2 nodes
duration = 5000
NodeAnimation = CreateNodeAnimation(#PB_Any, NodeID(0), duration, #PB_NodeAnimation_Spline, #PB_NodeAnimation_LinearRotation)
CreateNodeAnimationKeyFrame(NodeAnimation, 0, 0, 0, 0); key 0
CreateNodeAnimationKeyFrame(NodeAnimation, duration, 0, 0, 0); key 1
;- Set rotation for the 2nd node
SetNodeAnimationKeyFrameRotation(NodeAnimation,1,0,0,180)
;- Main loop
StartNodeAnimation(NodeAnimation,#PB_NodeAnimation_Once)
Repeat
AddNodeAnimationTime(NodeAnimation, TimeSinceLastFrame)
;- Display animation progression and rotation
totalTime + TimeSinceLastFrame
Debug "Node animation = " + LSet(StrF(100 * totalTime / duration,2),7) + "% : roll = " + StrF(NodeRoll(0),2)
TimeSinceLastFrame = RenderWorld()
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or NodeAnimationStatus(NodeAnimation) = #PB_NodeAnimation_Stopped
Code : Tout sélectionner
Node animation = 0.00 % : roll = 0.00
Node animation = 1.00 % : roll = 0.00
Node animation = 1.50 % : roll = 2.60
Node animation = 3.10 % : roll = 3.83
Node animation = 4.80 % : roll = 7.45
Node animation = 6.40 % : roll = 10.78
Node animation = 8.10 % : roll = 13.46
Node animation = 9.80 % : roll = 15.85
Node animation = 11.40 % : roll = 17.80
Node animation = 13.10 % : roll = 19.25
Node animation = 14.80 % : roll = 20.40
Node animation = 16.50 % : roll = 21.19
Node animation = 18.10 % : roll = 21.64
Node animation = 19.80 % : roll = 21.77
Node animation = 21.50 % : roll = 21.63
Node animation = 23.10 % : roll = 21.23
Node animation = 24.80 % : roll = 20.64
Node animation = 26.50 % : roll = 19.80
Node animation = 28.10 % : roll = 18.78
Node animation = 29.80 % : roll = 17.67
Node animation = 31.50 % : roll = 16.36
Node animation = 33.20 % : roll = 14.95
Node animation = 34.80 % : roll = 13.45
Node animation = 36.50 % : roll = 12.00
Node animation = 38.20 % : roll = 10.42
Node animation = 39.80 % : roll = 8.84
Node animation = 41.50 % : roll = 7.38
Node animation = 43.20 % : roll = 5.87
Node animation = 44.90 % : roll = 4.44
Node animation = 46.50 % : roll = 3.11
Node animation = 48.20 % : roll = 1.98
Node animation = 49.80 % : roll = 0.92
Node animation = 51.50 % : roll = 0.09
Node animation = 53.20 % : roll = -0.59
Node animation = 54.90 % : roll = -1.04
Node animation = 56.50 % : roll = -1.23
Node animation = 58.20 % : roll = -1.16
Node animation = 59.90 % : roll = -0.77
Node animation = 61.50 % : roll = -0.05
Node animation = 63.20 % : roll = 0.95
Node animation = 64.90 % : roll = 2.40
Node animation = 66.60 % : roll = 4.26
Node animation = 68.20 % : roll = 6.57
Node animation = 69.90 % : roll = 9.16
Node animation = 71.60 % : roll = 12.39
Node animation = 73.30 % : roll = 16.15
Node animation = 74.90 % : roll = 20.44
Node animation = 76.60 % : roll = 25.01
Node animation = 78.30 % : roll = 30.44
Node animation = 79.90 % : roll = 36.50
Node animation = 81.60 % : roll = 42.79
Node animation = 83.30 % : roll = 50.13
Node animation = 84.90 % : roll = 58.17
Node animation = 86.60 % : roll = 66.40
Node animation = 88.30 % : roll = 75.88
Node animation = 89.90 % : roll = 86.14
Node animation = 91.60 % : roll = 161.69
Node animation = 93.30 % : roll = -140.83
Node animation = 95.00 % : roll = -148.91
Node animation = 96.60 % : roll = -156.94
Node animation = 98.30 % : roll = -164.42
Node animation = 100.00 % : roll = -172.28