Paul.Brodin Posted March 10, 2015 Share Posted March 10, 2015 Any samples of using the Tracker in v2 beta from c#? iam trying to create a new interface that will allow set positions /targets of the camera to be recorded and the combine them for automated playback but struggling to even find the tracker class also once ive done this, will i be able to play the track in editor mode? or do i need to exit the editor to play it Link to comment
unclebob Posted March 10, 2015 Share Posted March 10, 2015 Hi Paul, I believe it should be the same as in C++. Basically, you have to write a bunch of UnigineScript function which will be called from C++ or C#. Have a look at source\csharp\samples\Api\Scripts\Callbacks sample. Also have a look at this topic the get the my idea, just scroll it down to the bottom and read the last answer: https://developer.unigine.com/forum/topic/3145-start-level-into-c-side/ Link to comment
Paul.Brodin Posted March 12, 2015 Author Share Posted March 12, 2015 OK, not got to far with this,but ive at least got a track in, using the editor so at least i can clarify the question a bit now, ive already got code that will grab the current camera location and orientation - is there anyway i can take a series of these parameters and build a track with a moving camera, using the c# tools? once i have this track, can it be played/previewed in edit mode? Thanks Link to comment
unclebob Posted March 12, 2015 Share Posted March 12, 2015 Paul, If you store track as a file then it'll be very easy to load and play it via editor. C# code in that case should take player position within time interval via C# API and put it to track file properly. You can use C# XmlSerializer or Unigine.Xml class to write it to file properly. After you filled track file, you can load it in the editor in Tracker window. You have to do write some UnigineScript code though if you want to use tracker without editor. Simple things, like creating a tracker instance, loading track file and animating its time in world script update function. We have a bunch of samples located in <sdkroot>/data/samples/tracker which will show how to do that runtime stuff. When you'll get used to that approach it's possible to write simple function in UnigineScript which will take one string argument and load proper track to tracker. Link to comment
Paul.Brodin Posted March 20, 2015 Author Share Posted March 20, 2015 Thanks - thats pointed my in the correct direction. Ive created a XML file of the track now, and put together a simple UI that allows me to record the specific camera locations and focal points that i need , and this plays back through the editor just fine. Iam just going to move on to using this without the TrackEditor being loaded, but have a few questions. 1) When replaying a stored track, i absolutely need to be able to control the speed of playback (even coming to a complete stop) - how would you recommend going about that 2) Is it possible to 'FIX' the camera to a set height above the terrain? 3) I would like to be able to save videos of the track playback (at a higher framerate, than i get, when dynamically playing the track back) - any hints? 4) is there anything to stop the track reseting to the start after playback, i would like to keep the last frame once the track finishes. Link to comment
Paul.Brodin Posted March 23, 2015 Author Share Posted March 23, 2015 Hi forum, just to post an answer to some of my own questions the code for the video grabber addin, points the correct direction for how the speed of the playback of a track could be controlled (and how to go about generating a video at a very high framerate) I ve got it working now so that a track that varies the position of an object is working nicely, but ive got a probem when trying to move the camera position, i cant reliably get the 'current' camera to be set to the camera that is moving in the track file, sometimes it works, sometimes it doesnt, sometimes i have to use the editor UI to select the camera. and sometimes the screen seems to toggle between two locations (1 along the track and then flicking back to the original camera location) is there something that needs to be done before starting the track to set the camera, rather than this piece of c# code private static void SetCamera(Editor editor, string sCameraName) { int iNodeID = editor.findNode(sCameraName); if (iNodeID == -1) return; Player myCamera = Player.create(editor.getNode(iNodeID)); Game game = Game.get(); game.setPlayer(myCamera); } Link to comment
unclebob Posted March 25, 2015 Share Posted March 25, 2015 Hey Paul! Sorry for the late reply. Could you please show track which is moving the object? Also, it'll be good to see the code or track where you set camera position. Link to comment
Paul.Brodin Posted March 26, 2015 Author Share Posted March 26, 2015 A bit more info - there is no problem when in 'Play' Mode, its only when i try to use the track object in the uniginescript, when iam in editor mode. I suspect the problem is that i am NOT moving the 'editor point of view', so the camera is moving according to the track script, but keeps jumping back frame after frame to the where the original editor camera was. Is there any way of getting the screen to follow 'game camera' even when in 'editor mode' Link to comment
unclebob Posted March 26, 2015 Share Posted March 26, 2015 Yup, just switch to "Game camera" in corresponding panel. Take notice that this editor feature is 2.0 only. Link to comment
Recommended Posts