Jump to content

  • Log In with Google      Sign In   
  • Create Account

KamRandle

Member Since 14 Aug 2012
Offline Last Active Nov 15 2014 04:15 PM

Posts I've Made

In Topic: Calculating Right Vector from Two Points

27 October 2014 - 02:25 PM

Hey haegarr! I got it working thanks to you! smile.png Thanks! :D


In Topic: Calculating Right Vector from Two Points

27 October 2014 - 11:39 AM

Hey! I got some sleep and I understand it now.  Lol I don't know why I was thinking it was a multiplication sign.  I changed it to "1 + FVector::DotProduct(s1, s2)" now. :D I will be testing it soon.


In Topic: Calculating Right Vector from Two Points

26 October 2014 - 08:42 PM

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:

float distance = Path->GetDistanceAlongSplineAtSplinePoint(i) + (segmentLength * s);
			float distance2 = Path->GetDistanceAlongSplineAtSplinePoint(i) + (segmentLength * s) + segmentLength;

			FVector v0 = GetTransform().InverseTransformPosition(Path->GetWorldLocationAtDistanceAlongSpline(distance));
			FVector v2 = GetTransform().InverseTransformPosition(Path->GetWorldLocationAtDistanceAlongSpline(distance2));

			FRotator v0Rotation = Path->GetWorldRotationAtDistanceAlongSpline(distance);
			FRotator v2Rotation = Path->GetWorldRotationAtDistanceAlongSpline(distance2);

			FVector s1 = FRotationMatrix(v0Rotation).GetScaledAxis(EAxis::Y);
			FVector s2 = FRotationMatrix(v2Rotation).GetScaledAxis(EAxis::Y);

			FVector h = s1 + s2;

			FVector extendDir = h * width / (FVector(1, 1, 1) + s1 * s2);

I was a little confused about calculating vthough (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?

points.png?dl=1

 

Thanks for the help, I really appreciate it again man! smile.png


In Topic: Calculating Right Vector from Two Points

23 October 2014 - 08:33 AM

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:

HighresScreenshot00003.png?dl=1

HighresScreenshot00004.png?dl=1

 

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:

HighresScreenshot00000.png?dl=1

HighresScreenshot00001.png?dl=1

HighresScreenshot00002.png?dl=1

 

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;

3) How would I compute the common vector?

4) How would I compute a sideway displacement?

 

Thanks! smile.png


In Topic: Supporting both DirectX & OpenGL

02 January 2014 - 12:47 PM

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! :)

PARTNERS