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"

My child actors don't behave correctly

Hi,

I am working on a controller for VR, which is basically a Static Mesh of a HTC Vive remote controller, and a 3D object in front of it. The 3D object is a child actor that can be changed when pressing a button on the controller. So far, it can be a cube or a cheese. The 3D object should move with the motion controller, since it's a descendant of the motion controller. The whole controller can also be changed when pressing another button, to switch between a sword and a shield for example.

This is the hierarchy I have :

  • VR_Pawn MotionController MotionControllerChildActor CustomControllerPawn CustomControllerChildActor * MyActorBluePrint that should move

If MyActorBluePrint is spawned using the BeginPlay event, everything works as espected. However if wait a bit (or use another event), it is spawned but it's somehow not attached to its parent, because it's not moving. GetChildrenComponents on CustomControllerChildActor returns an empty array while it returns a correct array when it's at BeginPlay, so I think there is something strange. When I change the whole controller, (or when I change the class of MotionControllerChildActor to an another one), the not moving MyActorBluePrint correctly destroyed all the time.

I simplified my script in order to have just a very simple actor, containing a movable StaticMeshComponent without physics and collisions. I attached a screenshot showing it.

What could be the problem? Do you know another solution to do what I want to do ?

Screenshot

Product Version: UE 4.12
Tags:
works.png (120.1 kB)
more ▼

asked Jul 14 '16 at 04:18 PM in Blueprint Scripting

avatar image

antoinegloum
59 6 13 14

avatar image SparkyMcSparks Jul 14 '16 at 11:40 PM

Shot in the dark, but the Set Child Actor Class is an extra step so maybe it's a weird timing issue because the Child Actor is presumably "none" after the game has initialized. You can select the Add Child Actor Component node and in Details panel set the class there.

alt text

addchildactor.png (59.9 kB)
avatar image antoinegloum Jul 15 '16 at 09:10 AM

If I set the ChildActorClass here and remove the set actor class node, it just doesn't spawn anymore :(

avatar image antoinegloum Jul 15 '16 at 11:38 AM

I found a pull request on Github that seems related, but the fix is already integrated in the stable release.

Anyway, I implemented a workaround. I removed all the child actors (they never did good) and used the SpawnActor and AttachToActor nodes instead.

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

0 answers: sort voted first
Be the first one to answer this question
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