Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi,
I use parameters from Thingworx to update the position of a model. Unfortunately, the update rate is rather low, so the "animation" is not smooth. Instead, the object jumps from the old position the new one.
In the past, using different tools, I fixed this by calculating the distance/frame and then applying it every frame. I know that then there is a lag (since I have to way until the position is updated to calculate the distance/frame) but that's OK, it is not super time critical.
So is there a way to get the refresh rate of the renderer and is there a function executed every frame?
Best
Hornhaut
Solved! Go to Solution.
Hi,
I think the issue possibly is not caused by the refresh rate of render - but possibly of the network where the value is not updated permanently and steady.
Possibly you can try to use some "smoother" which will work with some delay so that when delta > some considerable value then you will try to update the value in many steps which are small enough to have a fluently movement.
As trigger you can use the a $watch construct which will deliver the old and the new value. Possibly you can check also the system time to find out how fast is the change /speed of change and then to update the time where you will call the step to follow
e.g. watch of parameter:
//=========================================================
$scope.$watch('app.params.PAR1', function (newValue, oldValue, scope) {
console.log("Old Value -befor it was changed =" + oldValue);
//! it could be undefined first time called
console.log("new Value -after it was changed =" + newValue);
//prints the current $scope (copy) object passed to the $watch construct
// pay attention it has no $ !
console.warn(scope);
})
Hi,
I think the issue possibly is not caused by the refresh rate of render - but possibly of the network where the value is not updated permanently and steady.
Possibly you can try to use some "smoother" which will work with some delay so that when delta > some considerable value then you will try to update the value in many steps which are small enough to have a fluently movement.
As trigger you can use the a $watch construct which will deliver the old and the new value. Possibly you can check also the system time to find out how fast is the change /speed of change and then to update the time where you will call the step to follow
e.g. watch of parameter:
//=========================================================
$scope.$watch('app.params.PAR1', function (newValue, oldValue, scope) {
console.log("Old Value -befor it was changed =" + oldValue);
//! it could be undefined first time called
console.log("new Value -after it was changed =" + newValue);
//prints the current $scope (copy) object passed to the $watch construct
// pay attention it has no $ !
console.warn(scope);
})
Hi Roland,
thanks for your reply and your suggestion. I'll try that and see if it runs smoother 🙂
Best
Hornhaut