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"

Combine C++ and blueprint in character

I want to create my character logic (e.g. control, shooting, inventory etc) via C++ and add actors to my character via Blueprint. (I inherit blueprint from my character class.)

Example to explain what did I mean: I have Camera attached to socket on my skeleton mesh' head (first person view). Also I have Camera attached to spring (Third person view). I watch several tutorials and I think there is two ways:

  1. Add all components via blueprint editor. It is very useful to set position, rotation and sockets for my components. But this class is inherit, so I can't access my cameras and other components from C++ base class.

  2. Create all components in C++ class constructor using CreateDefaultSubobject, position and attach they manually. It's useful to access them from C++, but it's a bit uncomfortable to set all positions, socket names etc in code, instead using GUI.

Is there any way to combine this two ways? Maybe some virtual methods to setup parameters (e.g. socket names) from Blueprint Editor?

Product Version: UE 4.13
Tags:
more ▼

asked Sep 29 '16 at 01:32 PM in C++ Programming

avatar image

Markov Alexey
1 1 1 2

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

1 answer: sort voted first

you can make the class in C++, and add the components using the CreateDefaultSubobject, and then at bp side, you can still add few more components. Adding components in C++ doesn't mean you can't adjust their position in the blueprint editor. Nope. Once you donce from the C++ class, go ahead and make a bp based on it. And then inside the bp choose (open full blueprint editor) and there you are free to move and adjust parameters of the inherited components.

regarding the camera thing, you can add camera in BP, and at the beginning of the game, you do blend to it from the inherited C++ camera.

I used what you talking about here, in creating the character controller for this book. Not only mixing C++ and BP in terms of components, but also in terms of functions.

-m

more ▼

answered Sep 29 '16 at 02:04 PM

avatar image

mamoniem
1.2k 33 25 66

(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