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"

Colliding with a wall and stoping the actor

So how do I do this with C++. I have to do this with C++ for an assignment and I'm attempting it with box collision. I have the unfortunate issue of either not knowing what to search for or everyone is just using the easy blueprint method that I am not allowed to use.

I've got the following in the cpp file void AWall::OnBeginOverlap(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)

 if ((OtherActor != nullptr) && (OtherActor != this) && (OtherComp != nullptr))



I assume I need something in there. I just don't know how to get it block anythig from going through. if it helps I have another active collision issue here with a different class but, setup in the same way.

Product Version: UE 4.20
more ▼

asked Aug 18 '18 at 09:19 AM in C++ Programming

avatar image

5 1 2

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

1 answer: sort voted first

There is no need to handle a custom overlap event for this, just use sweep. Take a look here: https://www.unrealengine.com/en-US/blog/moving-physical-objects Just make sure that your wall collider has the "Block all" collision profile and sweep the actor that moves towards the wall.

more ▼

answered Aug 18 '18 at 03:50 PM

avatar image

1k 8 24 27

avatar image Hides_In_Bushes_ Aug 19 '18 at 02:35 AM

That doesn't really help. I'm trying to do this entirely with C++ code as well. I can't just use preset collisions if I can do it with code.

avatar image Sveitar Aug 19 '18 at 04:00 AM

That's not true, there is nothing that you cannot do with C++. Blueprints and editor aren't just magical things, they're writen in C++. You can set collision profiles for components in C++ using Component->SetCollisionProfileName("profilename");

avatar image Hides_In_Bushes_ Aug 20 '18 at 12:45 PM

thankyou. apparently I am a moron so thankyou for literally spelling it out. I thought you meant initially to alter the blueprint but, this does make sense.

(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