24 if (this->
speed <= 0.0f) {
31 for (i = 0; i < 3; i++) {
36 for (step = 0; step < steps; step++) {
37 for (axis = 0; axis < 3; axis++) {
57 if (move_pos > 2.0f) {
61 if (move_pos < -2.0f) {
66 this->
pos[axis] += move_pos;
67 this->
ref[axis] += move_ref;
75 this->
pos[axis] = this->next_pos[axis];
79 this->
ref[axis] = this->next_ref[axis];
93 sceVu0Normalize(flat, flat);
94 this->
angle_h = atan2f(-flat[0], -flat[2]);
95 this->
angle_v = -atan2f(dir[1], sqrtf(dir[0] * dir[0] + dir[2] * dir[2]));
155 float roll_matrix[4][4];
170 length = sqrtf(dir[0] * dir[0] + dir[1] * dir[1] + dir[2] * dir[2]);
171 flat_length = sqrtf(dir[0] * dir[0] + dir[2] * dir[2]);
173 if (flat_length == 0.0f) {
177 if (length == 0.0f) {
181 sin_h = dir[2] / flat_length;
182 cos_h = dir[0] / flat_length;
183 cos_v = flat_length / length;
184 sin_v = dir[1] / length;
186 matrix[0][0] = sin_h;
187 matrix[0][1] = -cos_h * sin_v;
188 matrix[0][2] = cos_h * cos_v;
191 matrix[1][1] = -cos_v;
192 matrix[1][2] = -sin_v;
194 matrix[2][0] = cos_h;
195 matrix[2][1] = sin_h * sin_v;
196 matrix[2][2] = -sin_h * cos_v;
198 matrix[3][0] = -this->
pos[0] * sin_h - this->
pos[2] * cos_h;
199 matrix[3][1] = sin_v * (this->
pos[0] * cos_h) + this->
pos[1] * cos_v - sin_v * (this->
pos[2] * sin_h);
200 matrix[3][2] = cos_v * (-this->
pos[0] * cos_h) + this->
pos[1] * sin_v + cos_v * (this->
pos[2] * sin_h);
204 if (this->
roll > PI) {
205 this->
roll -= TWO_PI;
208 if (this->
roll < -PI) {
209 this->
roll += TWO_PI;
212 sceVu0UnitMatrix(roll_matrix);
213 sin_roll = sinf(this->
roll);
214 cos_roll = cosf(this->
roll);
215 roll_matrix[0][0] = cos_roll;
216 roll_matrix[1][0] = sin_roll;
217 roll_matrix[0][1] = -sin_roll;
218 roll_matrix[1][1] = cos_roll;
219 MulMatrix(matrix, roll_matrix, matrix);