Scaling a Line
I have a theoretical line within a script with the start point of the line, the end point of the line, the slope, and the length of the line all stored in variables. How do I change the length of the line so that the end point and the length are matched up. Currently, I am doing this:
public Vector3 ScaleLine(float newLength){
Vector3 Result = new Vector3 (Position1.x, Position1.y, Position1.z);
Result.x = ((Position2.x - Position1.x)/Length) * newLength + Position1.x;
Result.z = ((Position2.z - Position1.z)/Length) * newLength + Position1.z;
return Result;
}
and I am running it through a script to find the angle between to points:
Vector3.Angle(wallLines[wallLines.Count - 1].Position1, line.ScaleLine(wallLines[wallLines.Count - 1].Length));
However, the angle is displayed incorrectly, and I think its due to the scale of the line being off.
So you basically have a cube you need to scale and rotate to cover the angle of a slope, right? It's not completely clear to me what you're wanting to do.
I'm trying to find the endpoint of the scaled line.
Your answer
Follow this Question
Related Questions
Predict the hit position 0 Answers
Check if a point is on the right or left of a vector? 2 Answers
Money-system for decillionare game 1 Answer
How do I convert a number and a range to another directly proportional number and range? 4 Answers
Why do nested if statements act differently than the && operator? 1 Answer