Hi guys,
I´m currently stuck at coverting my spline-based road from blueprints to C++. Off course everything is working fine in blueprints already and I was able to spawn the spline from C++. However, there is no Mesh showing in the game world. As examples seem to be very rare, I would welcome any help you can offer
What I have done so far:
if (Mesh)
SplineMeshComp->SetStaticMesh(Mesh);
SplineMeshComp->SetStartAndEnd(
Spline->GetWorldLocationAtDistanceAlongSpline(i*MeshSize),
Spline->GetWorldDirectionAtDistanceAlongSpline(i*MeshSize),
Spline->GetWorldLocationAtDistanceAlongSpline(i*MeshSize + MeshSize),
Spline->GetWorldDirectionAtDistanceAlongSpline(i*MeshSize + MeshSize)*TangentScale);
if (Material)
SplineMeshComp->SetMaterial(0,Material);
SplineMeshComp->RegisterComponent();
SplineMeshComp->RegisterComponentWithWorld(GetWorld()); //not sure about that line
SplineMeshComp->AttachTo(Spline);
SplineMeshComp->bCreatedByConstructionScript = true;
bCreatedByConstructionScript is now deprecated. Even if I try to set it to true, my meshes are not deleted on a new construction, so I am left with hundreds of meshes when I move my spline around. How do I fix this?
It’s weird that you commenting here actually remove the accepted answer :S I wonder if Epic could change that so we don’t actually lose Karma when this happens :S
I hope you don’t mind me commenting again. I have a new issue, regarding collisions, specifically that they only work in-editor and not in an exported Windows or Android build. I am not sure how to contact you through the answer hub, but if you could message me on the forums, I would greatly appreciate any assistance you can offer. Thanks!