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 can i make crosshair disapper when rightclick is released

I m trying to draw a crosshair when rightclick is pressed and erase it when the button is released,I m trying to stay in c++

Product Version: UE 4.15
Tags:
more ▼

asked Sep 27 '17 at 06:45 PM in C++ Programming

avatar image

SatyamJay
1 2 2

avatar image BenVlodgi Sep 27 '17 at 07:34 PM

How are you drawing it currently. Set a bool to not draw crosshair, then in your crosshair draw function call, check to see if that bool is set.

avatar image SatyamJay Sep 28 '17 at 03:05 AM

Is the draw function called every frame or,should I use the tick function.one more thing,I have created a bool in character.CPP how can I access that variable in HUD.CPP.

avatar image Beregron Sep 28 '17 at 09:42 AM

You have to include the hud.h in your character.cpp (or .h). Then you can get from your hudclass the variable.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You can bind the visibility of the crosshair to a UPROPERTY. If you are using Slate i would recommend you to check out how they do it on ShooterGame. Usually you would make your UPROPERTY private and create a public getter UFUNCTION to access it (encapsulation), also, use the meta "BlueprintPure" in order to access that function comfortably from Blueprints (it would make a pure BP accesible function and you will be able to access it on C++ aswell).If you are using UMG, check out this guide about variable (property) binding:

https://docs.unrealengine.com/latest/INT/Engine/UMG/UserGuide/PropertyBinding/

If you have any other further question please do ask it.

more ▼

answered Sep 28 '17 at 10:06 AM

avatar image

vorixo
326 2 6 13

(comments are locked)
10|2000 characters needed characters left
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