@@ -201,9 +201,14 @@ void Scene::render(Renderer* renderer, const Mat4& eyeTransform)
201201 defaultCamera = Camera::_visitingCamera;
202202 }
203203
204- Mat4 eyeCopy = camera->getNodeToParentTransform ();
205- // eyeTransform is in "camera/view" coordinates. Convert it to "model" coordinates
206- camera->setNodeToParentTransform (eyeCopy * eyeTransform.getInversed ());
204+ // There are two ways to modify the "default camera" with the eye Transform:
205+ // a) modify the "nodeToParentTransform" matrix
206+ // b) modify the "additional transform" matrix
207+ // both alternatives are correct, if the user manually modifies the camera with a camera->setPosition()
208+ // then the "nodeToParent transform" will be lost.
209+ // And it is important that the change is "permament", because the matrix might be used for calculate
210+ // culling and other stuff.
211+ camera->setAdditionalTransform (eyeTransform.getInversed ());
207212
208213 director->pushMatrix (MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
209214 director->loadMatrix (MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, Camera::_visitingCamera->getViewProjectionMatrix ());
@@ -224,7 +229,9 @@ void Scene::render(Renderer* renderer, const Mat4& eyeTransform)
224229
225230 director->popMatrix (MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
226231
227- camera->setNodeToParentTransform (eyeCopy);
232+ // we shouldn't restore the transform matrix since it could be used
233+ // from "update" or other parts of the game to calculate culling or something else.
234+ // camera->setNodeToParentTransform(eyeCopy);
228235 }
229236
230237#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
0 commit comments