I am trying to make a shutter door. this is a rendering from Blender of how it is supposed to work: Shutter Door.
I used the animation template that comes with Castle Game Engine but when I run the animation it only runs one of the animations from the glb file:
function TViewMain.Press(const Event: TInputPressRelease): Boolean;
begin
Result := inherited;
if Result then Exit; // allow the ancestor to handle keys
if Viewport1.TransformUnderMouse = Button then
begin
{ Port.PlayAnimation('Shutter.001', false);
Port.PlayAnimation('Shutter.002', false);
Port.PlayAnimation('Shutter.003', false);
Port.PlayAnimation('Shutter.004', false);
Port.PlayAnimation('Shutter.005', false);
Port.PlayAnimation('Shutter.006', false);}
Port.AnimationTimeSensor('Shutter.001').Start(true);
Exit(true);
end;
I have 6 individual animations in the .glb file. How do I run them all simultaneously?
The PlayAnimation method always runs a new animation, stopping the previous animation. (See docs at Castle Game Engine: CastleSceneCore: Class TCastleSceneCore ). This is deliberate, it allows PlayAnimation to e.g. perform cross-fading between old and new animation.
To play multiple animations simultaneously use the TTimeSensorNode.Start / TTimeSensorNode.Stop methods. You can get TTimeSensorNode instances that correspond to particular animations using e.g. TCastleSceneCore.AnimationTimeSensor method.
The first parameter false says whether to loop - I propose to set it as false since in your code sample, you also wanted to specify loop as false for PlayAnimation.
The second parameter says whether animation plays forward. true is the reasonable default
Let me know if you have additional questions about this. To help with above, I’d need to see more code, and more information “how it stopped working”