Jump to content

Gameconnection and camera position


Recommended Posts

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.

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...