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"

ArrowComponent Transform

Hi, I'm new to UE and apologize in advance if this quesiton has been asked a number of times before. I've googled, did not find anything that would give me a clue to solving this perticular problem, i've tried using many different things but nothing has worked. I am trying out the standard 3rd person template project using C++.

I have changed the character to content example owen character, the one that holds the gun, and attached a gun mesh to the character, right hand socket. Next in the blueprint, that i created from the C++ character class, I've added another C++ Arrow component, and parented that to the Gun, which in turn is parented to the Character mesh. In settings for the Arrow component I've set the parent socket to the 'muzzle' socket of the gun.

Now in my character.cpp, i've made a new input binding for firing a bullet / laser. and spawn actor works well.

The problem: The problem is the place to spawn. I've tried many different methods to get the Arrowcomponent and then get the co-ordinates, but nothing has worked. If i just do a GetComponents in the program and print that list to the console i can see the arrow component in the list, i've tried to cast it to UArrowComponent, to my class that is derived from UArrowComponent, but nothing's worked.

If i use GetArrowComponent() and then do the GetComponentToWorld(), it spawns the lasers at a..ahem..from the Inherited Arrow component co-ordinates..not very decent, anyway, that's not what i want anyway.

I've tried exposing a variable my customArrow type from C++ class and then set that to the custom Arrow in the character blue print, and the lasers are spawning but at a world 0,0,0, i suppose that is because i'm not passing my program the runtime instance and hence this behaviour.

Can anyone please suggest how can i get the custom Arrow component instance and the transform / vector location to spawn laser stuff.

Thanks in advance.

Product Version: UE 4.11
Tags:
more ▼

asked May 01 '16 at 11:26 AM in C++ Programming

avatar image

Ambak
31 2 4 8

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

1 answer: sort voted first

I think i got around that problem.

Since my Arrow Component was a C++ class, i created static method that would return the instance of the class. Used that method then in the character class to get the instance and called ComponentToWorld etc methods on it to get what i wanted and there you go..

more ▼

answered May 01 '16 at 03:11 PM

avatar image

Ambak
31 2 4 8

(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