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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Enable collision on Scene Component?

I´m making a interaction system, so when you look at the scene component "Intractable" I need it to send a event to the character etc. Basically my goal is:

When you look at a door knob, a npc, or anything intractable it popups a text saying the name of the interaction. And when you press space it interacts, very easy to do in all other engines, but I can´t understand how to do it in UE4. Thanks in advance :)

Product Version: UE 4.21
Tags:
more ▼

asked Jan 31 '19 at 05:39 PM in Blueprint Scripting

avatar image

MomoLegitMan
1 1

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

1 answer: sort voted first

Hi

You will need to do a line trace with a blueprint interface. I would setup a distance limit so it does not pick things up too far away.

I use this when coming up to shops, so when the player is close enough and taps the screen, it finds which BP I have tapped on and runs scripting within that blueprint. i.e. opens a widget.

You could run this off event tick, so where ever the player is looking, it could check example 500 ahead and when hits a intractable object, a widget opens and you can run interaction of that.

Blueprint interfaces explained here: https://answers.unrealengine.com/questions/867537/check-for-nearest-target-and-move-it-it-on-button.html?childToView=867725#answer-867725

Regards Narg

more ▼

answered Jan 31 '19 at 10:10 PM

avatar image

Narghile
1.7k 74 38 110

avatar image MomoLegitMan Jan 31 '19 at 10:31 PM

Thank you, I'm an experienced programmer so I know all about interfaces, I just don't know how to put like a collision box on a scene component. I've worked with other engines and it has worked there very easily

avatar image aNorthStar Feb 01 '19 at 12:26 AM

@MomoLegitMan... welcome! :)

A line trace is an option... you could also add a collision component and use 'hit' or 'overlap' to generate the event. I think I've seen youtube tutorials on this topic implementing interfaces too

avatar image Narghile Feb 01 '19 at 04:41 AM

Hi

I can not post pictures at moment, not sure why.

But, in Treasure Chest for example.

  1. Make the Blueprint

  2. Around chest, add a box collision - under Collision on the dropdown menu on left side.

  3. Name it

  4. Now in the menu on the right side, down the bottom you will see in green, Add event for Begin overlap. Press the +

  5. Go to event graph and you will see a node - 'On Begin Overlap'

  6. Out from 'Other Actor' drag out and search for your character, example 'Thirdpersoncharacter'.

  7. This will create a node 'Cast to thirdpersoncharacter'

  8. The event node will only fire when the character overlap the collision box.

  9. 'Cast Failed' will execute if anything else overlaps that is not the player character.

It seems a lot more work then it is, but it is very simple.

EDIT: Hope these pictures work.

https://pasteboard.co/HZ5S9An.png

https://pasteboard.co/HZ5SzNQ.png

https://pasteboard.co/HZ5SKAV.png

Regards Narg

avatar image MomoLegitMan Feb 01 '19 at 08:16 PM

Thank you, I know how to do collision and line traces and interfaces and all of that, my question is still how to add a collision sphere to a SCENE COMPONENT, that is very important. Would a line trace work for SCENE COMPONENTS ? It´s important that my system is dynamic, not a brute force solution

avatar image aNorthStar Feb 02 '19 at 05:52 AM

@MomoLegitMan... as far as I know scene component and a collision component are simply different things.

As you know, you can have a collision component and scene component in the same location on your actor. But... as far as I know a scene component in itself will neither collide with other objects nor block a trace (though I haven't tested it... and your proposition worth testing though).

avatar image MomoLegitMan Feb 02 '19 at 08:37 AM

Okay, in unity and Arma this was very easy. I just made a object added a trigger box to it and have it a script. I don't want to hand code each . Maybe I could have the scene component attach a collide on start. Thanks

avatar image aNorthStar Feb 02 '19 at 08:42 AM

well, you can start with a generic actor... and add whatever components are useful... mesh, collision box/sphere/etc, scene, etc

"A scene component has a transform and supports attachment, but has no rendering or collision capabilities" UE4 tooltip

honestly, I'm puzzled why you absolutely need some kind of combined scene/collision component at all... scene component is just a blank dummy helper..

avatar image Narghile Feb 07 '19 at 10:09 AM

When you add a sphere collision, it is automatically apart of/attached to the scene component.

Narg

(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