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 DrawDebugBox() with rotation ?

I have ATriggerBox class, no matter I do I can't make TriggerBox visible and add another static mesh is no use cause it gets invisible too.

and when I use DrawDebugBox() I can get the vision of trigger box but DrawDebugBox() not follow rotation.

I will be thankful if someone can tell me how to give rotation to DrawDebugBox() or how to make TriggerBox visible?

Product Version: Not Selected
Tags:
more ▼

asked Apr 25 '19 at 09:03 PM in C++ Programming

avatar image

AAriyAA
69 5 9 15

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

1 answer: sort voted first

There is a DrawDebugBox() command that takes a rotation as a FQuat. If you don't feel comfortable with Quaternions use a FRotator and do rotator.Quaternion() on it.

https://api.unrealengine.com/INT/API/Runtime/Engine/DrawDebugBox/2/index.html

e.g.: DrawDebugBox(GetWorld(), GetActorLocation(), FVector(200.0f, 400.0f, 300.0f), rot.Quaternion(), FColor::Red);

for making the TriggerBox visible in game, set "Actor Hidden In Game" to false, it's a setting under rendering. alt text

showactor.png (19.0 kB)
more ▼

answered Apr 25 '19 at 09:49 PM

avatar image

Lardo Deepdelver
786 5 4 6

avatar image AAriyAA Apr 25 '19 at 10:29 PM

Thanks for your fast replay. you are right its rotate now but now when it rotates draw box getting different scale. code:

 DrawDebugBox(GetWorld(), GetActorLocation(), GetComponentsBoundingBox().GetExtent(), GetActorQuat(), FColor::Red, false, 0.01, 0, 50);

for visibility, I tried sed visibility both in C++ and editor but nothing appear even when I add a cube from BP driven from Class, Cub getting invisible too in runtime. code :

 bHidden = false;
     SetActorHiddenInGame(false);

avatar image Lardo Deepdelver Apr 25 '19 at 10:48 PM

tried your code works for me had to change the 50 at the end to 1 otherwise the lines are way to thick

do you maybe have more than one scenecomponent on that actor? GetComponentsBoundingBox() returns a combined bounding box you could try just getting the box of the component you actually want to show

hmn showing the BoxTrigger in the game works perfectly fine for me Place a BoxTrigger from modes in game Set Actor Hidden In game to false in the details setting of that Box Trigger * BoxTrigger shows in game

alt text red Cube debug draw, green cube Actor hidden = false

boxtrigger3.png (369.6 kB)
(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