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 to attach objects to enumeration?

Hello!

I have been trying to "get comfortable" with the blueprint system (the concept isn't totally clear yet. I'm used to objects, scripts, prefabs, but this is something totally new :P) and was learning different nodes, more recently Single Line Trace for Objects. The object type want's to be an enum-array, so I made one, but I have yet to figure out how do you mark other blueprints as, for instance, "shootable".

Hoping for answers, -DoctorPC

Product Version: Not Selected
Tags:
more ▼

asked Jul 04 '14 at 03:07 PM in Blueprint Scripting

avatar image

DoctorPC
398 44 39 51

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

1 answer: sort voted first

In project settings, go into the collision menu. This is how you make new object and trace channels so you can tailor what collides with what. After you make them, they are automatically assigned to every object so you have to go into all your blueprints and update them.

As for the enum array, I just use trace by channel which doesn't require an array of objects, just the proper trace channel.

more ▼

answered Jul 05 '14 at 12:58 AM

avatar image

Zeustiak
1.8k 131 68 110

avatar image DoctorPC Jul 05 '14 at 05:01 AM

sounds legit, I'll give it a shot :)

avatar image DoctorPC Jul 05 '14 at 02:06 PM

Tried it, and it works, or well, it should work, but yet it doesn't. Something in my blueprint causes every shot be counted as miss, I would really love if you took a look at it:

firing 1 https://www.dropbox.com/s/ghnkgabdvrtr9nl/Screenshot%202014-07-05%2017.04.08.png

firing 2 https://www.dropbox.com/s/xosfmuk9xkdjebt/Screenshot%202014-07-05%2017.04.41.png

target https://www.dropbox.com/s/qjqcih0017rxbyy/Screenshot%202014-07-05%2017.05.18.png

Thanks, -DoctorPC

avatar image Zeustiak Jul 05 '14 at 02:35 PM

What is New Var 1 set to? That is probably your problem. Instead of tracing for objects, use the Trace by Channel node. Then you can just set your Channel to Visibility so you can make sure everything works before testing out new channel and object settings.

Also, use the Draw Debug on the trace node. It will show a red line when you shoot, and whatever it hits will have a little red box to let you know it hit.

Also, print off the hit actor so you can be sure what is being hit so you can be sure it isn't just a failed cast or something.

avatar image DoctorPC Jul 05 '14 at 03:27 PM

New var 1 = Target. It's just a way of telling make array which object from the enum to choose.

I now swapped to trace by channel, and it looks like this: https://www.dropbox.com/s/zcey9nvla7xajq2/Screenshot%202014-07-05%2018.26.00.png

the outcome is identical, and the object name seems to not print. (other areas are as they were)

btw. Some odd effect, or visual artifacts: when moving the screen around a light source quickly enough, the gun seems to create "ghosts" of itself, Those faded pistols can not be seen in screenshots, though :/

avatar image Zeustiak Jul 06 '14 at 12:38 AM

So your red debug trace is showing little red box signifying a hit on the object you are aiming at?

avatar image DoctorPC Jul 06 '14 at 10:29 AM

yes, or well, approximately where I'm aiming at. It doesn't seem to be always the same, sometimes it goes 200 pixels to the right, sometimes 500 pixels. It's being a bit weird.

avatar image DoctorPC Jul 06 '14 at 02:22 PM

I finally got it working! Thank you so much, here, have some extremely well earned karma :3

avatar image DoctorPC Jul 06 '14 at 02:54 PM

Okay, did more investigation about the off set. Looks like it goes to the left of the center of the screen, and the further away I'm from the object, the more to the left the ray hits, which is quite peculiar. Is there any reason for this to happen?

avatar image Zeustiak Jul 06 '14 at 10:17 PM

I would look at whatever method you are using to set your vectors for the trace. Not sure what else could cause that.

avatar image DoctorPC Jul 07 '14 at 03:47 AM

Maybe coordinates of the camera somehow aren't "in the middle of the screen, but further back"?

avatar image Zeustiak Jul 07 '14 at 04:07 AM

I actually had that problem once. My camera was offset from the player pawn somehow and it was causing me all kinds of collision problems. Took days to figure out.

avatar image DoctorPC Jul 07 '14 at 04:21 AM

well, could you possibly explain how did you fix it in the end? :)

avatar image Zeustiak Jul 07 '14 at 05:08 AM

Basically just brought the camera to the character capsule.

It depends on how you have your character setup. I don't actually have a character, more like a camera floating in the sky that is attached to a character capsule for the sake of movement inputs.

Do you have a blueprint assigned as your primary pawn in game mode? This is where I have my character setup. In the components view of that blueprint, it shows my camera and the capsule, and I just made sure they were on top of each other with rotation properly aligned.

It might be a little more complicated if you are third person.... First person could be near the same.

For my trace anyway, I Get Player Controller, Convert Mouse Location to World Space, and Feed World Location into Start(on Line Trace), and then add World Lcoation and World Direction plus some extra length to feed into End(on Line Trace).

avatar image DoctorPC Jul 07 '14 at 05:21 AM

I in the other hand have the world loaction of the camera, add 32000 in it's each coordinate, and do math "CamLoc*Forward vector of CamRot) which I get the end point from. I go see the rotations :)

(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