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"

Dynamic Multicast Delegate not Broadcasting! Help!

Please view my answer to this question for the actual question

Product Version: UE older version
Tags:
more ▼

asked Oct 01 '17 at 03:33 PM in C++ Programming

avatar image

Pixel Arts
1 2 3

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

2 answers: sort voted first

First thing, you are using for your line trace "LineTraceSingleByObjectType" and "ECollisionChannel::ECC_GameTraceChannel1", so did you actually create a new Object channel for this new Object type? The reason it not working is because you are using this different collision channel for your Rotate() function than your Grab() function.

To create the new object channel go to ProjectSettings->Collision->ObjectChannels and create your new channel. Set Defaults to "Block". (note that it has to be an Object Channel and NOT a TraceChannel as you are using a "LineTraceSingleByObjectType" trace). alt text

Then you must go to your Project Folder then Config->DefaultEngine and open that file. There should be a line that says something like:

 +DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,Name="NameOfYourChannel",DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False)

make sure you are using the correct ECC_GameTraceChannel for your Rotate() function.

Then in the objects that you want to "Rotate", you must go into their Details Panel->Collision. Set "Collision Presets" to "Custom" and "Object Type" to "NameOfYourChannel". alt text

Then the second thing, why do you want to use an Event Dispatcher (Delegate) inside the Tick Event. Event Dispatchers (Delegates) are for things you only want to occur when something changes, putting this in the tick event voids that purpose.

You can simply do this and it will broadcast when you can "rotate":

 void UGrabber::Rotate()
 {
     auto HitResult = GetFirstPhysicsBodyInReach(ECollisionChannel::ECC_GameTraceChannel1);
     auto ComponentToGrab = HitResult.GetComponent(); // gets the mesh in our case
     auto ActorHit = HitResult.GetActor();
 
     /// If we hit something then attach a physics handle
     if (ActorHit)
     {
         UE_LOG(LogTemp, Error, TEXT("Actor Hit"))
             
         TurnStatue1.Broadcast();
     }
     else
     {
         
         UE_LOG(LogTemp, Warning, TEXT("Actor Not Hit"))
     }
 
 }


more ▼

answered Oct 01 '17 at 09:11 PM

avatar image

Shogo999
235 10 5 14

avatar image Pixel Arts Oct 02 '17 at 12:18 PM

I don't think it's the line tracing that's the problem because if I replace the broadcasting with a UE_LOG output then it does output. So the line tracing works fine. The Grab and Rotate are different, the grab is meant to pick up objects with object type physics body, I didn't want to pick up the statue so I made a function called Rotate which line traces for GameTraceChannel1 so it can broadcast the rotation event to that statue. Even though I have proved the line trace works fine and detects the statue it still doesn't broadcast. And I put the broadcast in the tick event instead of the rotate function because it usually crashes when I put it in the rotate function when the function is called. Oh and I posted an answer because I don't know how to directly reply to your answer.

avatar image Pixel Arts Oct 02 '17 at 02:52 PM

I haven't tried it yet though. I will try it soon and tell you if it works

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

It hasn't worked. Nothing happens when pressing E,

more ▼

answered Oct 03 '17 at 06:12 AM

avatar image

Pixel Arts
1 2 3

(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