Small update on this. The camera animation goes fine and everything but after the animation, things start to go wrong.
The camera rotates and moves along with the bone from the animation (that is okay). However because the camera is parented, the actual Vec3 position and rotation are not being updated during the animation. When the animation is complete and I want to place my camera somewhere in the scene, then the positions from the bone are being combined with the newly set positions. I think that this happens because of the parenting.
I tried removing the object with the animation but that resolves into a crash without any further information. Is there another way for me to unparent the camera from the bone-animation? Or thoughts on things that I might try.
here is some code I am using. (note that the code is distributed in functions and is not being run right after each other.)
parenting and adjusting camera to the bone-animation:
animation-start = level1:FindChild("animation_Start")
bone1 = animation-start:FindChild("bone1")
fw.main.camera:SetParent(bone1)
fw.main.camera:SetPosition(Vec3(0,-3,0))
fw.main.camera:SetRotation(Vec3(0,260,0))
During the animation, the camera position remains 0,-3,0 and the rotationis 0,260,0.
play the animation:
--Play the bone-animation
if bone-animation == 1 then
frame = frame + AppSpeed() / 10
animation-start:Animate(frame, 1, 0, 1 )
if frame >= 1023 then
bone-animation = 0
frame = 0
Level1PlayerStart()
end
end
After the animation is done, find playerStart.
start = level1:FindChild("start")
fw.main.camera:SetPosition(start:GetPosition())
The last line doesn't seem to work at all. The camera does not get positioned at the 'start' enity.