Skip to content

Commit 4692a20

Browse files
authored
add linear interpolation between head tracking points.
1 parent cc1913e commit 4692a20

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

360plugin.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,27 @@ local writeHeadPositionChange = function()
117117

118118
local outputTs = string.format("%.3f-%.3f ",lasttimePos,newTimePos)
119119
local changedValues = {}
120-
local maximumTimeoutReached = (lasttimePos-newTimePos) > 5.0
120+
local movementDuration = (newTimePos-lasttimePos)
121+
local maximumTimeoutReached = movementDuration > 5.0
121122

122123
if initPass or pitch ~= last_pitch or maximumTimeoutReached then
123-
changedValues[#changedValues+1]= string.format(", [expr] v360 pitch %.3f",pitch)
124+
changedValues[#changedValues+1]= string.format(", [expr] v360 pitch 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_pitch,pitch,lasttimePos,movementDuration)
124125
end
125126
last_pitch=pitch
126127

127128
if initPass or yaw ~= last_yaw or maximumTimeoutReached then
128-
changedValues[#changedValues+1]= string.format(", [expr] v360 yaw %.3f",yaw)
129+
changedValues[#changedValues+1]= string.format(", [expr] v360 yaw 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_yaw,yaw,lasttimePos,movementDuration)
129130
end
130131
last_yaw=yaw
131132

132133

133134
if initPass or roll ~= last_roll or maximumTimeoutReached then
134-
changedValues[#changedValues+1]= string.format(", [expr] v360 roll %.3f",roll)
135+
changedValues[#changedValues+1]= string.format(", [expr] v360 roll 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_roll,roll,lasttimePos,movementDuration)
135136
end
136137
last_roll=roll
137138

138139
if initPass or dfov ~= last_dfov or maximumTimeoutReached then
139-
changedValues[#changedValues+1]= string.format(", [expr] v360 d_fov %.3f",dfov)
140+
changedValues[#changedValues+1]= string.format(", [expr] v360 d_fov 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_dfov,dfov,lasttimePos,movementDuration)
140141
end
141142
last_dfov=dfov
142143

0 commit comments

Comments
 (0)