Gameconnection and camera position

Expanding and utilizing the engine via C++.
1 post Page 1 of 1
newaged
Posts: 31
Joined: Sat Feb 14, 2015 12:27 am
by newaged » Sun Jan 24, 2016 6:17 am
Posting here again because I haven't learned how to github yet.
I was going through some tutorials when an issue popped up. The camera position given by GameTSCtrl::OnMouseDown and %GameConnection.getCameraObject().GetPosition() were clearly different, and it was making the serverCmd provided by the tutorial behave oddly. I wasn't sure if that was intended or not, so I made a new method to use in its place.

Code: Select all

DefineEngineMethod(GameConnection, getControlCameraPosition, Point3F, (), ,
   "@brief Gets the true position of this GameConnection's camera.\n\n"

   "@see GameConnection::getCameraObject()\n\n")
{
   MatrixF transform;
   if (!object->getControlCameraTransform(0.032f, &transform))
      return {0, 0, 0};
   return transform.getPosition();
}

Stick that somewhere near the end of gameConnection.cpp. %GameConnection.getControlCameraPosition() will return the position of the camera the same way OnMouseDown would.
1 post Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests