public evaluateAtTime ( double ut, Vector3 &position, |
||
ut | double | |
position | Vector3 | |
orientation | ||
velocity | Vector3 | |
return | void |
public void initialize(Track track, GameObject ghost) { this.track = track; this.ghost = ghost; trackStartUT = track.GetStartTime(); totalReplayTime = track.GetEndTime() - track.GetStartTime(); if (track.EndAction == Track.EndActions.LOOP) { totalReplayTime += track.LoopClosureTime; } currentReplayTime = 0; replayStartUT = Planetarium.GetUniversalTime(); lastUpdateUT = replayStartUT; setGhostToPlaybackAt(trackStartUT + currentReplayTime); Vector3 trackPos; Quaternion orientation; Vector3 velocity; track.evaluateAtTime(trackStartUT + currentReplayTime, out trackPos, out orientation, out velocity); ghost.transform.position = trackPos; ghost.transform.rotation = orientation; playbackFactor = 0; Debug.Log("initialized replayBehaviour, ghost at trackPos =" + trackPos.ToString()); }
public void stopRecording() { //if (activeTrack.EndAction == Track.EndActions.LOOP) if (activeTrack != null) { Vector3 startPos = Vector3.zero; Vector3 endPos = Vector3.zero; Vector3 vel = Vector3.zero; Quaternion rot = Quaternion.identity; activeTrack.evaluateAtTime(activeTrack.GetStartTime(), out startPos, out rot, out vel); activeTrack.evaluateAtTime(activeTrack.GetEndTime(), out endPos, out rot, out vel); activeTrack.LoopClosureTime = Vector3.Distance(startPos, endPos) / vel.magnitude; } activeTrack = null; recording = false; }
private void setGhostToPlaybackAt(double time) { Vector3 trackPos; Quaternion orientation; Vector3 velocity; track.evaluateAtTime(trackStartUT + currentReplayTime, out trackPos, out orientation, out velocity); ghost.transform.position = trackPos; ghost.transform.rotation = orientation; currentVelocity = velocity; //Debug.Log("Replay: Ghost at " + trackPos.ToString() + " with ori=" + orientation.ToString()); }