How do i click a static mesh and turn the player torwards it?
I'm just started using this program and have been searching everywhere for a tutorial for this. What I need is to be able to click an static mesh and then face that mesh. I do have a player controller with the mouse events activated. I guess my main problem is getting the mouse events to work. I have seen a few tutorials and I can get a simple click to work, but not by clicking a specific mesh. Thanks
asked Jul 29 '14 at 12:45 AM in Blueprint Scripting
What you can do here is make use of a node called 'Trace hit under cursor' (or a similar name). This node will return the Actor that is under your mouse cursor. So on the click event, you will call this node and get the Actor that is under the cursor. Check and make sure this Actor is the object you are looking for. You can then get its position and rotation which you can use to rotate your character.
Another option is to create a special blueprint for your 'clickable' meshes. You can add a click event directly in its blueprint, which will fire up when you click an instance of this blueprint. Then you can set the characters position/rotation.
if all the meshes in your level are clickable, go with the first method. IF there are only a few special objects that are clickable, go with second method
answered Jul 29 '14 at 03:08 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here