#Tank Steering Thread
1 messages ยท Page 1 of 1 (latest)
I just need to know what this means
2 points in 3d space is not enough information to orient it.
There needs to be more info.
You want to stand at pointA and 'lookAt' pointB?
Well... long explanation ahead:
tldr;
You're creating a rotation that looks in the direction of 'forward' while standing in an orientation so that up is the direction of 'up'.
Your 'forward' should be 'pointB - pointA', and up is most likely Vector3.up or <0,1,0>
Yes, and your SignedAngle using Vector3.up, correct?
Yes
You gotta know which plane the angle is based on to calculate angle in 3D
and you're doing on XZ plane so use the normal of that plane which is Vector3.up
Here's script again simplified
A = driver.transmission.transform
B = SteeringAngle
Vector3 C = B - A;
float D = Vector3.SignedAngle(-A.forward, C, -Vector3.up);
float angle = Mathf.DeltaAngle(D, A.eulerAngles.y);
int angleNormal = angle > 0 ? -1 : 1;
Well.. you don't need DeltaAngle
A's rotation is already considered because you're getting angle from A.forward
What is the real problem
Okay, but C.x is 0
Which means B and A has same x
But pink line is not parallel with world z axis
Therefore pink line is not drawing from A to B
Great ๐
Ah yeah I remember navigation path was like that
You can do it ๐