New camera position with the animation (transition) to the click of a button

Hi AA!

https://playground.babylonjs.com/#AJADK6#10

Let’s see. Line 72 needed to be a property name-string. You had it set as a vector3 in quotes.

Line 74 - changed to vector3 type. You had it set vector2.

Line 75 - set to loopmode CONSTANT… just because I like it to hold position at end of animation. NOTE: The animation is still STARTed when it ends… so activating an animation.stop() in the callback function… might be wise. There MIGHT BE a .disposeOnEnd or .stopOnEnd Boolean property on animations. Not sure.

Line 82 - camera.position.clone() for beginning animation position.

Line 83 & 93 disabled… because I don’t know what they do… yet. :slight_smile:

Line 86… added a “middle frame”… just because the animation docs demo for outTangent and inTangent… had a middle frame. :slight_smile:

Line 102 - turned OFF loopmode and added a onAnimationEnd callback func.

Line 111 - 114… I guess we need that highly-annoying little function, again. It keeps the camera from working properly… at scene RUN, though. Junk. I don’t know when/how that function suddenly started being “needed”, but it has to go. Core/we need a different way to do that. Comments welcome.

This is related to the issue that @timetocode worked-around in another cam-animation thread.

AND… I changed some keyframe target values… just for fun.

Now it works… almost. Needs some tweaks. Hope this helps. Party on!

2 Likes