Animate based on line trace
I'm trying to make a system where a character holds a flashlight at their side and points it via animation toward the output location of a line trace. Ie, when a character is close to a wall, the light will be pointed up to point at where the characters is looking, and as the character walks backward, the light would be held slowly more level to continue pointing at the right place. Any idea how to make the animation work based on line trace?
asked Sep 21 '18 at 08:38 PM in Blueprint Scripting
I'm not sure what the best way is but I think you dont need a trace. I think you could just add a scene component or a socket to your pawn's camera, at a some distance away but attached so that it is always in the center of your viewport no matter which way you turn your head.
Then every Tick you can have the Flashlight or the Bone holding it rotate to the LookAt rotation from the flashlight to the scenecomponent. Or something like that.
I havent done anything with skeletal animations yet so i dont know how aimoffset works. if aimoffset is some kind of float between 0 and 1 then maybe you can use my idea and get the dot product between the camera forward vector and that LookAt vector and use the result of that somehow.
answered Sep 23 '18 at 08:14 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here