
Code Block
Tags:
New Feature
Creator:
sakie_on_staging
Code:
/* Backflip animation for the local player */
const playerId = myId; /* or api.myId */
const twoPi = 2 * Math.PI;
api.animateEntity(playerId, {
animationDurationMs: 1000,
loop: true,
nodeAnimations: {
TorsoNode: { timeline: [
{ timeFraction: 0, rotation: { point: [0, 0, 0] } },
{ timeFraction: 0.5, rotation: { point: [0, 0, 0] } },
{ timeFraction: 1, rotation: { point: [0, 0, 0] } }
]},
/* Optional: add some arm motion for realism */
ArmRightMesh: { timeline: [
{ timeFraction: 0, rotation: { point: [0, 0, 0] } },
{ timeFraction: 0.5, rotation: { point: [4, 0, 1] } },
{ timeFraction: 1, rotation: { point: [0, 0, 0] } }
]},
ArmLeftMesh: { timeline: [
{ timeFraction: 0, rotation: { point: [0, 0, 0] } },
{ timeFraction: 0.5, rotation: { point: [4, 1, 0] } },
{ timeFraction: 1, rotation: { point: [0, 0, 0] } }
]}
}
}, 0, 1.0);Instructions:
You Can Change the Numbers