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"

Constraint Component invalid on BP to C++ Function

When I spawn a Physics Constraint Component in BP and initialize all the values and then pass it to a C++ target as a parameter, the Actor-Variables get set to NULL (but are C++-Class instances). Furthermore the constraint doesn't react to any action called from the C++ variable pointer.

Is this a bug, or is there a proper way to spawn something in BP and save a pointer to it in C++ to work with it there?

Product Version: UE 4.9
more ▼

asked Sep 27 '15 at 12:22 PM in Bug Reports

avatar image

96 8 17 26

avatar image Doug E ♦♦ STAFF Sep 28 '15 at 03:13 PM

Hey Omamanfred-

I tried to test this by creating an actor class and writing a function to print the name of a physics constraint component:

 void  AMyActor::ConstraintTest(UPhysicsConstraintComponent* TestConstraint)
     if (GEngine)
         GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::Magenta, TestConstraint->GetName());

I created a blueprint based on this class and added a physics constraint component to it. I then printed out the name of the component both with a BP Print node and the ConstraintTest() function.

alt text

In doing so I saw the name printed both with the blueprint print as well as through code. Is this similar to how you're passing the component into code?


Doug Wilson

avatar image MykonCodes Sep 29 '15 at 09:45 AM

Hey, they way I'm doing it was like this:

I have a C++ Class with an pointer to an UConstraintComponent (empty at first). Then I go to a blueprint not related to this class and call AddConstraintComponent and call a C++ from there to set this new spawned Component to the pointer of the C++ Class. Before that I completely initialize the constraintedObjects, so they are set in the BP version. Now, when I give the pointer of the Component to the C++ class, both Constrained Actor 1 and Constrained Actor 2 are null-pointers, however the original constraint does work ingame. As expected, calling "BreakConstraint" in C++ doesn't do anything whereas calling it from the BP actually does break it. However, the pointer of the component itself seems to be valid.

avatar image MykonCodes Sep 29 '15 at 09:46 AM

As an Info: I check "Manual Attachment" on the Component

avatar image Doug E ♦♦ STAFF Sep 29 '15 at 02:36 PM

Hey OmaManfred-

Could you post some example code or blueprint screenshots so I can get an idea of what your setup looks like? What class is the class containing your UConstraintComponent a child of? If the blueprint is not related to the class with the pointer, how is the result of the add component referencing the class to set the pointer? How are you initializing the constraint?

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

1 answer: sort voted first

Hi OmaManfred,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

more ▼

answered Oct 05 '15 at 06:48 PM

(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