So here is whats happening: I am moving an object to the Right (x+) by adding force to the physics box. Now I then set my ViewOffSet X to be equal to the X position of the object. Like so:
void Object::Movement()
{
m_posX = agk::GetSpriteX(m_spriteID);
m_posY = agk::GetSpriteY(m_spriteID);
agk::SetSpritePhysicsForce(m_spriteID,m_posX - 5, m_posY - (m_spriteHeight* .5),m_speed,0);
agk::SetViewOffset(m_posX,0);
ViewOffsetX = agk::GetViewOffsetX();
}
Then calling it here in my main.cpp
void app::Loop ( void )
{
object->Movement();
agk::Sync();
}
The position of my sprite is at the top left (I haven't offset it) so when I start the object at 0,0 essentially my ViewOffSet is also 0,0 which holds true when I debug my program.
Although the values are the same when I am stepping through with the debugger my box is still a good 4 - 5 pixels away from the edge of the screen and it will jitter back and forth. If the ViewOffSet X value is the same as the X position of my object shouldn't the object stay at the left side of the screen constantly?
Am I missing something here? Is there a better way to match up my ViewOffSet with the position of my object?