Camera Messages

From TrainzOnline
Jump to: navigation, search

Camera messages are driver only messages sent when the in game camera focuses on a different object or when the camera viewing mode is changed. Camera messages are always broadcast but the message source varies depending on the message minor.

Variants 1 to 4 are sent by the interface object? and are notifications that the camera mode has changed.

  1. Camera,Internal-View
  2. Camera,External-View
  3. Camera,Tracking-View
  4. Camera,Roaming-View
  • Camera,Interior-Changed is sent by the newly selected cabin? when the focus changes to a new train.
  • Camera,Target-Changed is sent by the object which has just acquired camera focus. This is usually, but not always, a train.

Camera,Target-Changed can be used to keep track of the train in focus by checking that msg.src is a train and assigning it to a variable in your script. To avoid every instance of your script tracking the same data you can use a static class or a script library to hold the information.

The World class contains methods for reading and controlling the camera.


See Also

Personal tools