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. 

Simple spline mesh example help


I am fairly new to Unreal. I am trying to spawn a simple spline mesh. I have had no success so far. The code I have causes the engine to crash. I have even tried removing the for loop to do only a single start, end and tangent for a mesh, but it did not work either. I've tried removing different parts and changing it up, and it looks like it crashes when calling the "MySplineMesh->SetStartAndEnd()" function.

My method and code may be completely wrong. Any help or advice would be very much appreciated. Thank you.

(about the error: Access violation - code c0000005 (first/second chance not available) I received a similar error c0000001 at one point with this struggle as well, but not most recently.)

      // Set this actor to call Tick() 
     PrimaryActorTick.bCanEverTick = false;
         // Create a root component
     USceneComponent *TopScene = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
     RootComponent = TopScene;
     // create a SplineComponent
     USplineComponent *MySpline = CreateDefaultSubobject<USplineComponent>(TEXT("SplineComponent"));
     // add tangents 
     MySpline->AddSplinePoint(FVector(1000, 1, 1), ESplineCoordinateSpace::World);
     MySpline->AddSplinePoint(FVector(1, 1000, 1), ESplineCoordinateSpace::World);
     MySpline->AddSplinePoint(FVector(2000, 1, 1), ESplineCoordinateSpace::World);
     MySpline->AddSplinePoint(FVector(1, 2000, 1), ESplineCoordinateSpace::World);
     MySpline->AddSplinePoint(FVector(3000, 1, 1), ESplineCoordinateSpace::World);
     // create static mesh
     for (int32 i = 0; i < MySpline->GetNumberOfSplinePoints() - 1; i++)
         //USplineMeshComponent *MySplineMesh = CreateDefaultSubobject<USplineMeshComponent>(TEXT("SplineMeshComponent"));
         USplineMeshComponent *MySplineMesh = ConstructObject<USplineMeshComponent>(USplineMeshComponent::StaticClass(), this);
         MySplineMesh->AttachParent = MySpline;
         // set scale of mesh
         MySplineMesh->SetStartScale(FVector2D(1, 1));
         MySplineMesh->SetEndScale(FVector2D(1, 1));
         FVector pointLocationStart, pointLocationEnd, pointTangentStart, pointTangentEnd;
         MySpline->GetLocationAndTangentAtSplinePoint(i, pointLocationStart, pointTangentStart, ESplineCoordinateSpace::Local);
         MySpline->GetLocationAndTangentAtSplinePoint(i + 1, pointLocationEnd, pointTangentEnd, ESplineCoordinateSpace::Local);
         MySplineMesh->SetStartAndEnd(pointLocationStart, pointTangentStart, pointLocationEnd, pointTangentEnd);
Product Version: UE 4.10
more ▼

asked Mar 30 '16 at 09:42 PM in C++ Programming

avatar image

1 1 1

(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