Download

Total newbie post

I’m coming from a Unity perspective. Paper2D seems to be really more developer friendly then Unity’s Sprite Engine. I do have a c++ background although it’s been 7 years.

I have completed the FloatingActor tutorial and I would like to know how can I detect a Mouse Click and a Touch on that object. Although FloatingActor is using 3d it should be a good enough starting point. c++ or blueprint to c++ would be great! If nothing else, just point me in the right direction.

(I originally posted this to the answer hub, I believe that was the wrong place or was it correct? :slight_smile: )
Many Thanks! Bubba

Here is what you may be looking for. This is how to get events regarding the mouse. It will show you in BP, but that should get you on the right track.

https://answers.unrealengine.com/questions/82735/how-to-detect-object-on-mouse-click.html

Thanks but I’m really not looking for a straight blueprint solution,

Was trying to point you in the right direction but heres a step by step:

First, make sure you have touch and mouse over events enabled
CollisionComponent()->bEnableMouseOverEvents = true;

then create an on clicked delegate in your actor:

CollisionComponent->OnClicked.AddDynamic(this, &YourClass::OnClickEvent);

and make your delegate do what it needs.

Or, just have a generalized MouseClick event in your controller that does the following:

OnMouseClick perform a raycast and see if it collides with an object.
If it does, deselect anything selected.
Then check to make sure its the type you need it to be.

This documentation here has a good basics on ray-casting to find items in a scene based on what the mouse is looking at. Doesnt include on click, but just add a click event that calls something similar to this and it should work.

Thanks, Like I said, total newbie to Unreal and only understand enough blueprint to follow the tutorials. I’m sure your answers will help somebody with a little more experience.