Game Development Community

BUG: T2DSceneCamera.Clone & world limits

by Kzoink · in Torque X 2D · 07/05/2007 (1:19 pm) · 3 replies

An assertion is triggered when attempting to use Clone() on a camera with world limits feature turned on. The assertion states that the T2DSceneCamera.CopyTo(TorqueObject obj) method needs to be modified to contain the following:

T2DSceneCamera obj2 = (T2DSceneCamera)obj;
obj2.UseCameraWorldLimits = UseCameraWorldLimits;
obj2.CameraWorldLimitMin = CameraWorldLimitMin;

#1
07/05/2007 (4:27 pm)
That isn't a bug, it's a warning to you as the developer that you need to implement the code it suggests.

Unfortunately, there was no way to have the project handle the implementation directly for you (we tried, I think it's an XB360 portability issue or something similar), so instead it tells you that you need to perform those actions before copyTo() can work properly.

Now, that being said (it's not a bug), if you didn't make any changes yourself to the camera, then it might be something we need to do for completeness sake--I'll bump it up. I'm not sure though what your use case is for wanting to clone the camera? There is normally one camera per scenewindow....
#2
07/07/2007 (5:23 pm)
I could modify the function, but since it is engine code and I don't have the source, I would have to inherit from that class to fix it and make the camera I am cloning in code, and then I don't think I would be able to modify it like the default scene camera in the Edit pane->Camera rollout TXB.

The clone is not really necessary, as I can create a new camera and copy the old camera's parameters manually as a workaround, but it was just part of the code in the TankBuster game where the camera is cloned for the camera shake effect, and I figured I'd do it the same way, but ran into the assert when I turned on world limits for the camera in TXB.

The assertion on clone is only triggered when trying to perform the clone on a camera with world limits, which TankBuster doesn't have, so that's why it works in that game. I think the base T2DSceneCamera class should be modified to copy the parameters that are causing the assertion when UseCameraWorldLimits is set to true, and that's why I reported it as a bug.
#3
07/08/2007 (8:58 am)
I agree, this is something we need to look at. The Tank Buster tutorial was most probably written before the mechanism for reporting that assert came into existence, so I'll have the devs take a look.

Thanks for the follow up :)