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"

SplineMeshComponent bugged? c++

I have been working on spawning splinemeshcomponent through c++

But I don't see them working.

This is what I am doing .h

     /** Spline component responsible for creating the ring structure */
     UPROPERTY()
     TSubobjectPtr<USplineComponent> SplineComp;
 
     /** Array to store mesh components */ 
     UPROPERTY()
     TSubobjectPtr<USplineMeshComponent> SplineMeshArray[12];


And the cpp file

 APlanetActor::APlanetActor(const class FPostConstructInitializeProperties& PCIP)
     : Super(PCIP)
 {
 SplineComp = PCIP.CreateDefaultSubobject<USplineComponent>(this, TEXT("SplineComp1"));
     
     for (int32 i = 0; i < 12; i++)
     {
         FString TheName = "Splinemesh" + FString::FromInt(i);
         SplineMeshArray[i] = PCIP.CreateDefaultSubobject<USplineMeshComponent>(this, FName(*TheName));
         SplineMeshArray[i]->SetStaticMesh(SplineStaticMesh);
         SplineMeshArray[i]->ForwardAxis = ESplineMeshAxis::Y;
     }
 }

After setting the values of the splinecomponent,

I set the values of splinemeshcomponent a bit after the actor has been spawned

 for (int32 i = 0; i < 11; i++)
 {
     FVector StartLocation, StartTangent, EndLocation, EndTangent;
     SplineComp->GetLocalLocationAndTangentAtSplinePoint(i, StartLocation, StartTangent);
     SplineComp->GetLocalLocationAndTangentAtSplinePoint((i + 1), EndLocation, EndTangent);
     SplineMeshArray[i]->SetStartAndEnd(StartLocation, StartTangent, EndLocation, EndTangent);
     FVector Location = SplineMeshArray[i]->GetStartPosition();
     GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, FString::SanitizeFloat(Location.X) + " " + FString::SanitizeFloat(Location.Y) + " " + FString::SanitizeFloat(Location.Z));
 }

The GEngine shows the location of all the spline mesh but, I can't see the mesh at all. The code is executed a bit after beginplay.

Product Version: Not Selected
Tags:
more ▼

asked Sep 17 '14 at 01:42 PM in C++ Programming

avatar image

envenger
428 77 118 148

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

1 answer: sort voted first

It might be that you need to call RegisterAllComponents(); after you create the SMCs

more ▼

answered Sep 30 '15 at 11:18 AM

avatar image

Doublezer0
77 1 5 9

(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