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"

How to change root component of ACharacter?

The object inherited through: ACharacter (C++) -> AMyObject (C++) -> AMyObject_BP (Blueprint)

I want to change root component from CapsuleComponent to BoxComponent. My character is a flying vehicle. What can I do with it?

I tried next variants:

1. Change RootComonent in C++ from UCapsuleComponent to UBoxComponent in constructor.

Result: failed, implicit errors after launch editor and crash). (BoxComponent is UPROPERTY)

  BoxComponent = CreateDefaultSubobject<UBoxComponent>(ACharacter::CapsuleComponentName);
  RootComponent = BoxComponent;

2. Set the capsule component sizes to minimal and create the new collision object in component list.

Result: failed, new collision objects not responds collision (collision is setted up, physics, etc...) and vehicle overlaps the all.

Help please :)

Product Version: UE 4.8
more ▼

asked Aug 25 '15 at 09:46 AM in C++ Programming

avatar image

559 44 63 91

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

2 answers: sort voted first

CharacterMovementComponent currently only accepts vertical capsules as the collision component.

The issue with boxes is that rotation is tricky, since corners may pass through objects between the start and end locations, since sweeps only support initial and end rotations, not sweeps through changes in rotation.

You may be able to extend the CharacterMovementComponent code to sweep something other than a capsule (possibly override MoveUpdatedComponent()) and modify the hit results as a result, but I think you'll still have issues with rotation since we don't check collision when rotation changes (not necessary for vertical capsule).

... this is the information I have on this subject. I know they were considering new shapes in a future release, but I haven't heard when that would be.

more ▼

answered Aug 25 '15 at 10:21 AM

avatar image

2.3k 114 61 233

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

If for some reason you still want to change a hierarchy of a character you can do the following in your derived class constructor:

     USkeletalMeshComponent * mesh = GetMesh();
     RootComponent = mesh;
more ▼

answered Oct 05 '18 at 04:23 PM

avatar image

231 2 6 15

(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