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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Cannot attach SplineMeshComponents to Scene, even though they're both movable

I have set both my SplineMeshComponents, my Spline, my RootComponent(Which is named Scene) all to movable and yet I keep receiving an Warning:

 "Warning AttachTo: '/Game/UEDPIE_0_TestLevel.TestLevel:PersistentLevel.BP_VRMotionController_C_1.Scene' is not static  (in blueprint "BP_VRMotionController"), cannot attach '/Game/UEDPIE_0_TestLevel.TestLevel:PersistentLevel.BP_VRMotionController_C_1.SplineMeshComponent_1' which is static to it. Aborting."

And I have set just about everything to movable that would affect the spline meshes' and yet it keeps giving me this warning. I would appreciate any help on why this warning keeps coming up, because when you get over a thousand warnings for this one issue its difficult to ignore.

 //Creating the variable for the spline mesh
         USplineMeshComponent* newSpline = NewObject<USplineMeshComponent>(this);
         
         //Setting other default values.
         newSpline->AttachToComponent(Scene, FAttachmentTransformRules::SnapToTargetIncludingScale);
 
         //This has to occur after creating a new object in the world.
         newSpline->RegisterComponentWithWorld(GetWorld());
         newSpline->RegisterComponent();
 
         //If the spline is static then it has errors when attaching
         newSpline->SetMobility(EComponentMobility::Movable);
         newSpline->SetRelativeLocation(FVector::ZeroVector);
         newSpline->SetRelativeRotation(FRotator::ZeroRotator);
         newSpline->SetRelativeScale3D(FVector(1.0f, 1.0f, 1.0f));
 
         //Setting the visual representation of the splineMeshes.
         newSpline->SetStaticMesh(SplineMesh);
         newSpline->SetMaterial(0, SplineMaterial);
 
         newSpline->SetStartTangent(FVector(100.0f, 0.0f, 0.0f));
         newSpline->SetEndPosition(FVector(100.0f, 0.0f, 0.0f));
         newSpline->SetEndTangent(FVector(100.0f, 0.0f, 0.0f));
         newSpline->SetForwardAxis(ESplineMeshAxis::X);
         newSpline->SetSplineUpDir(FVector(0.0f, 0.0f, 1.0f));
         newSpline->SetCollisionEnabled(ECollisionEnabled::NoCollision);
 
         splineMeshes.Add(newSpline);
Product Version: UE 4.14
Tags:
more ▼

asked Jan 04 '17 at 07:27 PM in C++ Programming

avatar image

Oldsiren
161 24 25 31

avatar image Doug E ♦♦ STAFF Jan 04 '17 at 09:27 PM

Hey Oldsiren-

Where are you calling this code? When I create my spline component and declare its mobility as movable in my class constructor, I do not get any warnings about not being able to attach it to the root component. Can you provide additional details about how you're setting up your actor / spline component?

avatar image Oldsiren Jan 05 '17 at 12:57 PM

Of course, I am calling this in a separate method/function that is used for updating an arc using splines. Here is the rest of that function:

avatar image Oldsiren Jan 05 '17 at 12:59 PM
     void AVRMotionController::UpdateArcSpline(bool FoundValidLocation, TArray<FVector> SplinePoints)
     {
     if (!FoundValidLocation)
         {
             SplinePoints.Empty();
             SplinePoints.Add(ArcDirection->GetComponentLocation());
             SplinePoints.Add((ArcDirection->GetForwardVector() * 20.0f) + ArcDirection->GetComponentLocation());
         }
     
         FVector Thing = FVector::ZeroVector;
     
         for (int32 index = 0; index < SplinePoints.Num(); index++)
         {
             Thing = SplinePoints[index];
             //Build a spline from all trace points. This generates tangets 
             //we can use to build a smoothly curved spline mesh
             ArcSpline->AddSplinePoint(Thing, ESplineCoordinateSpace::Local, true);
         }
     
         //Update the point type to create the curve
         ArcSpline->SetSplinePointType(SplinePoints.Num(), ESplinePointType::CurveClamped, true);
     
         for (int32 index = 0; index < ArcSpline->GetNumberOfSplinePoints() - 2; index++)
         {
 
                //FILL IN THIS BLANK AREA WITH THE CODE FROM ABOVE
     
             //Set the tangents and position to build slightly
             //bend the cylinder. All cylinders combined 
             //create a smooth arc.
             newSpline->SetStartAndEnd
             (
                 SplinePoints[index],
                 ArcSpline->GetTangentAtSplinePoint(index, ESplineCoordinateSpace::Local),
                 SplinePoints[index + 1],
                 ArcSpline->GetTangentAtSplinePoint(index + 1, ESplineCoordinateSpace::Local)
             );
         }
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey Oldsiren-

The reason for the warning is that the root component (Scene) needs to be set to Static. If you set the Scene component's mobility to Static, then the warning won't appear for the SplineMeshComponent.

Cheers

Doug Wilson

more ▼

answered Jan 05 '17 at 02:47 PM

avatar image Oldsiren Jan 05 '17 at 04:11 PM

So I did that, and it pretty much broke my game. I tried a workaround which was create another Scene and have it under the root scene and parented it to that and set that to static and now I only get one warning vs the thousands of warnings that would flood the message log for every spline mesh I created. The reason is because that scene has to be static to attach to the root scene, but as I said before this breaks what I'm trying to do and this does exactly what I need so no point in trying to fix that one warning.

(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