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"

Component doesnt follow the root

I have created a C++ class derived from the character class. I have added a spherecomponent

on *.h:

  UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Collision")
  USphereComponent* ProxSphere;

and on *cpp:

  ProxSphere = CreateDefaultSubobject<USphereComponent>(TEXT("ProxSphere"));

Next I created a Blueprint out of it. Whenever I place the BP into the world the Sphere Component is glued to 0,0,0 while the mesh and root capsule folow my cursor. Once I release the mouse and place the BPsomewhere in the world, only then the sphere component follows the root somehow.

Any idea what is wrong here?

Thank you

Product Version: UE 4.9
more ▼

asked Nov 08 '15 at 11:11 AM in C++ Programming

avatar image

7 3 2 5

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

1 answer: sort voted first

That's probably because you created your spherecomponent but didn't actually attach it to anything. In order to attach it to the rootcomponent of the character, you can use:
ProxSphere->AttachTo(RootComponent, NAME_None, EAttachLocation::SnapToTarget);
That way it should follow the movement of the root component.

more ▼

answered Nov 08 '15 at 12:09 PM

avatar image

138 4 3 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