Hi,
I currently working in an application where I’m using CZML in streaming. This CZML is wrote in php and the problem that I have is when I try to orientate a model using unitQuaternion.
I used the following function in php to transform pitch roll and yaw in quaternions:
function toQuaternion($pitch, $roll, $yaw){
$t0 = cos($yaw * 0.5);
$t1 = sin($yaw * 0.5);
$t2 = cos($roll * 0.5);
$t3 = sin($roll * 0.5);
$t4 = cos($pitch * 0.5);
$t5 = sin($pitch * 0.5);
$q=;
$q = $t0 * $t2 * $t4 + $t1 * $t3 * $t5;//w
$q = $t0 * $t3 * $t4 - $t1 * $t2 * $t5;//x
$q = $t0 * $t2 * $t5 + $t1 * $t3 * $t4;//y
$q = $t1 * $t2 * $t4 - $t0 * $t3 * $t5;//z
return $q;
}
``
but the resultant orientation is very random… and I don’t know how to solve it.
Thank you so much.