I already have the animation ready, i just don’t know how to play it when player clicks a cube.
but i can’t access the animation, i can access it only in level blueprint
Have you tried using an “on clicked” event? You can create one of these by selecting your Cube mesh component in the BP and at the bottom of the right hand details panel there are a bunch of green “+” signs one of them is for an “on clicked” event.
The cube is a BP actor and i created a matinee animation
Oh wow, i will try that tomorrow, i will inform if it worked because I’m going to sleep now.
What do you mean you can’t access the animation? Doesn’t your cube BP have the animation as part of its BP? Or do you mean you used something like sequencer or matinee and created an animation for the cube in your level? Also, just so I am clear…this cube…is it a BP or just a static mesh actor?
you can also get the on click event for your cube in the level bp. you just need to select the cube in the level then in the level bp right click the graph then select “add event for” → input->mouse input-> add on clicked.
You should do this in 2 steps. Firstly, create an intractable area into your cube BP Like a sphere, in which your character will be able to interact with the cube. Then just share a variable between your cube BP and your character one, thanks to the “get play controller” and “cast to third person ch” nodes. Then if your character is in the collision box/sphere, you should use an input event. On press, just check if your character is in the collision box, if true, set another variable to true like “play animation”, and then you can cast it from your anim BP. You’ll just have to get it in there and to use it as a transition to a new state, which will play your interaction animation. Let me know if it helps
Thanks, it worked! Now, is it possible to play the animation when player points on the cube and clicks E?
Thanks, it worked but i prefer Thompson’s method.
That’s fine we are basically saying the same thing haha As for your other question, yes you can. You need to have a line trace running, break the hit result, check if the hit actor is the cube and if yes allow E keyboard event to play the animation. So E would have to be hooked up to a branch node that checks if the out hit actor is the cube if true play animation otherwise do nothing.
I did another thing - created a boolean named “IsPointingButton”, created an event for the cube “OnCursorBeginOver set boolean to yes” and “OnCursorEndOver set boolean to no” and now if player clicks E and if boolean is YES, open the door