Hey haegarr! Thanks for the help so far, I really appreciate it. Sorry to bug you with all these questions, but I found a way to get the right vector using the points rotation (I didn't know it had a function like that until yesterday) and was wondering if this looks right now:
I was a little confused about calculating vi though (extendDir is that vector). How I read it was "[halfway vector] multiplied by [width] divided by [a vector with all components set to 1] plus [sideway vector 1] multiplied [sideway vector 2]". I'm pretty sure I didn't read it right. Can you type the equation out in words? lol And are these the right points for each calculation?
Thanks for the help, I really appreciate it again man!
I'm not sure what your problem exactly is. So I describe the entire process in a more or less coarse manner, and we can go into details at the step identified by you.
1.) Sub-divide the spline path into linear segments.
2.) Compute the (perpendicular) sideway vectors at the beginning and end of each segment.
3.) Compute a common vector for each pair of sideway vectors from the end of one segment and the beginning of the next segment. This step is used to avoid a gap on an outside bend or an overlapping on an inside bend, resp.
4.) Compute a sideway displacement of the line segment using a defined (half) width, so that a closed mesh is yielded in.
What I am trying to do is get away from this:
FVector extendDir = FVector(0, width, 0);
Because it always extends the mesh on the Y axis, I get this result if I move the spline back while moving it left or right:
What I would like to do is have the mesh maintain it's width where ever it is. I don't want it to get squished together, it needs to be the same width at the end as it was before. So I would like to have everything extend according to the right vector's of the points.
1) I have everything sub-divided and I can change how may segments each part is sub-divided into:
2) I've calculated the sideway vectors for each segement (bottom left point of triangle to left top point of triangle). Does this look correct?
// Transform the bottom left point of the triangle and left top point of the triangle by y axis to get the right vector.
FVector v0right = FRotationMatrix(Path->GetWorldRotationAtDistanceAlongSpline(Path->GetDistanceAlongSplineAtSplinePoint(i) + (segmentLength * s))).TransformVector(FVector(0, 1, 0)).SafeNormal().ForwardVector;
FVector v2right = FRotationMatrix(Path->GetWorldRotationAtDistanceAlongSpline(Path->GetDistanceAlongSplineAtSplinePoint(i) + (segmentLength * s) + segmentLength)).TransformVector(FVector(0, 1, 0)).SafeNormal().ForwardVector;
Hello everyone! Thanks for the answers. I think I may just write my DirectX version first. It is being developed alongside a game that I am using it for. It will be my first game to be released. After I am finished, then I'll focus on GL versions. How many people do you guys think use Bootcamp on OS X? Thanks!