x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How To Fire Mouse-Hover Callback

Hello, I have an Actor class that has a callback function that is suppose to fire when the cursor begins hovering over the mesh but it never actually fires. What am I doing wrong?

In constructor:

 MyMeshComponent->OnBeginCursorOver.AddDynamic(this, &AMyActor::MyOnBeginMouseOver);

Callback Function:

 void AMyActor::MyOnBeginMouseOver(UPrimitiveComponent* TouchedComponent)
 {
     GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, TEXT("Mouse Over"));
 }

This is a first person shooter so the reticle is always in the center of the screen but I'm not sure if the mouse cursor is there too as it is hidden... that might have something to do with it.

Product Version: Not Selected
Tags:
more ▼

asked Mar 26 '14 at 08:06 AM in C++ Programming

avatar image

nistic
1 2 3 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I was having trouble getting a mouse event to trigger as well. Apparently the function needs to be marked as UFUNCTION(), like this:

  UFUNCTION() void MyOnBeginMouseOver(UPrimitiveComponent* TouchedComponent);

This may be obvious to some people, but it certainly took me a while.

more ▼

answered Apr 18 '14 at 12:42 AM

avatar image

chipgw
26 6

avatar image Kochab Jun 20 '14 at 05:16 AM

Thanks for replying to this. I would have never guessed...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

"This is a first person shooter so the reticle is always in the center of the screen but I'm not sure if the mouse cursor is there too as it is hidden... that might have something to do with it."

Yes this is it

use the ShowMouseCursor option in the PC class to figure out where the cursor actually use

 //override this to return true all the time, or whenever you want
 virtual bool ShouldShowMouseCursor() const;


Use GetMousePosition() to.. well.. you know :)

Rama

PS: you could set this directly, but probably less useful in longer term

 /** Whether the mouse cursor should be displayed. */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=MouseInterface)
 uint32 bShowMouseCursor:1;




more ▼

answered Mar 26 '14 at 08:22 AM

avatar image

Rama
10.6k 446 343 1085

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question