brian.firfer Posted March 28, 2013 Posted March 28, 2013 Is there really no documentation or examples on how to get the data out of the TrackerTrack object? We have a camera track and I want to apply the position/rotation data to our camera. Help?
brian.firfer Posted March 28, 2013 Author Posted March 28, 2013 Actually, looks like the heaven demo uses them. Was confusing since the sanctuary had xml and txt versions but only used the txt That said, still not seeing how the track data gets assigned to the camera. With the CameraPath object it was pretty straight forward p.setFrame(dummy,frame + clamp); But I am not seeing the equivalent for the TrackerTrack
brian.firfer Posted April 1, 2013 Author Posted April 1, 2013 I'm still missing something on this. The example in the documentation shows how to set the time value, but the question is how do you get the current interpolated values for the camera. Is there an interface for this that I am missing?
manguste Posted April 1, 2013 Posted April 1, 2013 Brian, Why don't you want to actually run the Tracker so it handles update of camera position? You can find the example how to do it in Heaven (heaven.h), SDK samples or in docs. (Sanctuary does not use it as you've noticed). Anyway, it's possible to customize tracks by changing data/core/systems/tracker/paramweters/*.parameters, but running Tracker seems like a much better idea.
brian.firfer Posted April 2, 2013 Author Posted April 2, 2013 I do in fact just want to run the track. However, I would assume that a specific track could be applied to any object instance, including the camera/player object. Below is the example in the docs. Can you please point to the line in which the position/orientation data is transferred to the camera object? #include <core/systems/tracker/tracker.h>/**/Unigine::Tracker::TrackerTrack track;float time, min_time, max_time, unit_time;/**/int init() {// Use Tracker namespace.using Unigine::Tracker;// Create a Tracker that will play track animations.Tracker tracker = new Tracker();// Load the created Tracker tracks from file.track = tracker.loadTrack("samples/tracker/tracks/render_00.track");// Get the start time of the Tracker (in units).min_time = track.getMinTime();// Get the end time of the Tracker (in units).max_time = track.getMaxTime();// Get the duration of Tracker unit (in seconds).unit_time = track.getUnitTime();// Set the initial time to play tracks animation.time = track.getMinTime();return 1;}/**/int update() {if(track == NULL) return 1;// Update the tracks animation time.time += engine.game.getIFps() / unit_time;time = min_time + ((time - min_time)) % (max_time - min_time);// Set animation time for tracks.if(engine.game.isEnabled()) track.set(time);return 1;} Same with the heaven demo, I see where the track is updated to its current time value.. // track parameters float min_time = track.getMinTime(); float max_time = track.getMaxTime(); float unit_time = track.getUnitTime(); // update time if(!pause) time += engine.game.getIFps() / unit_time; if(time >= max_time) { Heaven::setSoundTime(0.0f); time = min_time; } // set track track.set(time); However, I fail to see how the track actually interacts with the Player camera which is set as the current engine player. Is the track some how hooked to the camera behind the scenes? Assuming that is the case, how can you hook a track to an arbitrary instance of an object/node? For instance, if we made a track for a door opening and closing, but created many instances of this door an various buildings, code created doors, how would one play the track on a specific instance of the door? Thanks!
Recommended Posts