[Closed] Adding Z rotation?
Hi all, lately I’ve been fiddeling with this problem, I have a line (with Ghosttrail plugins) that is used to create a tyre trail. In this line I’ve set the position track and rotation track to a script, which looked like this:
Position script:
testRay = $Tape_FL as ray
FL = intersectRay $Land testRay
FL.position
Rotation script:
testRay = $Tape_FL as ray
FL = intersectRay $Land testRay
FL_rot = matrixFromNormal FL.dir
(here the Tape is used as ray to check the collision of each tyre and the terrain and get the normal from it, so it can be used to determine the trail Z position and the angle. Each tape are linked to the Tyre, and each has a label corresponding to the Tyre position, ie: FL for Front Left, RL for Rear Left and so on.)
And it worked fine, except when the Car turn 90 degrees or more, the trail would twist, and it looks horrible. Is there anyway to get Z rotation of the tyre and apply it to the line, so it would conform to the surface, but the Z rotation follows the tyre rotation?
Okay I Finally got it working, and here is the expression:
testRay = $Tape_FL as ray
FL = intersectRay $Land testRay
FL_rot = matrixFromNormal FL.dir
FL_rot_quat = FL_rot as quat
(quat FL_rot_quat.x FL_rot_quat.y $subaru_fl_wheel.rotation.z FL_rot_quat.w)
But the trails jitters a lot now at Z axis, what went wrong?