Hi
I want to make the scene camera heading always between 0 and 360.
I bind the Heading to the property below, where I set the value using % 360.
This seems to work, but after a couple of whole rotations, it spins around wildly?
Why might this be??
I've updated the code to this, but I get the same problem.
If I rotate it slowly I think it works, but if I spin it fast it spins back a full 360 I think.
Could it be to do with inertia??
I want to make the scene camera heading always between 0 and 360.
I bind the Heading to the property below, where I set the value using % 360.
This seems to work, but after a couple of whole rotations, it spins around wildly?
Why might this be??
Code:
// SceneCameraHeading
private double _SceneCameraHeading;
public double SceneCameraHeading
{
get
{
return _SceneCameraHeading;
}
set
{
if (value != _SceneCameraHeading)
{
_SceneCameraHeading = value % 360;
NotifyPropertyChanged("SceneCameraHeading");
// IsModified
IsModified = true;
}
}
}(06-01-2015, 12:48 PM)ZENUAV Wrote: Hi
I want to make the scene camera heading always between 0 and 360.
I bind the Heading to the property below, where I set the value using % 360.
This seems to work, but after a couple of whole rotations, it spins around wildly?
Why might this be??
Code:// SceneCameraHeading
private double _SceneCameraHeading;
public double SceneCameraHeading
{
get
{
return _SceneCameraHeading;
}
set
{
if (value != _SceneCameraHeading)
{
_SceneCameraHeading = value % 360;
NotifyPropertyChanged("SceneCameraHeading");
// IsModified
IsModified = true;
}
}
}
I've updated the code to this, but I get the same problem.
Code:
_SceneCameraHeading = (value % 360) + (value < 0 ? 360 : 0);If I rotate it slowly I think it works, but if I spin it fast it spins back a full 360 I think.
Could it be to do with inertia??

