function getCarForwardSpeed(car) local moveSpeed = { x = 0.0, y = 0.0, z = 0.0 } local…
Private research annotation
Sign in to add a private research label or note.
- User
function getCarForwardSpeed(car) local moveSpeed = { x = 0.0, y = 0.0, z = 0.0 } local forwardDirection = { x = 0.0, y = 1.0, z = 0.0 }
codelocal rotX, rotY, rotZ, rotW = getVehicleQuaternion(car) moveSpeed.x, moveSpeed.y, moveSpeed.z = getCarSpeedVector(car)-- vraŝaem vektor kolesnicy vpered, ispolʹzuâ kvaternion local temp1_a, temp1_b, temp1_c, temp1_d = rotW * 0 - rotX * 0 - rotY * 1 - rotZ * 0, rotW * 0 + rotX * 0 + rotY * 0 - rotZ * 1, rotW * 1 - rotX * 0 + rotY * 0 + rotZ * 0, rotW * 0 + rotX * 1 - rotY * 0 + rotZ * 0
codeforwardDirection.x, forwardDirection.y, forwardDirection.z = temp1_a * rotW + temp1_b * -rotX + temp1_c * -rotY + temp1_d * -rotZ, temp1_a * -rotX + temp1_b * rotW + temp1_c * -rotZ - temp1_d * -rotY, temp1_a * -rotY - temp1_b * -rotZ + temp1_c * rotW + temp1_d * rotX-- isčislim skalârnoe proizvedenie, daby polučitʹ skorostʹ vpered local forwardSpeed = moveSpeed.x * forwardDirection.x + moveSpeed.y * forwardDirection.y + moveSpeed.z * forwardDirection.z
codereturn forwardSpeedend
почини этот lua код
- Assistant