Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Problem with ViewOffSet T2

Author
Message
Greg_C
13
Years of Service
User Offline
Joined: 22nd May 2010
Location:
Posted: 26th Jan 2012 02:11 Edited at: 26th Jan 2012 02:12
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:



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?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 26th Jan 2012 11:11
My guess here is that the physics is being updated after you have applied the view offset.

You could try stepping the physics manually after you apply the force. Like this (I think, I use Tier 1)...


Greg_C
13
Years of Service
User Offline
Joined: 22nd May 2010
Location:
Posted: 26th Jan 2012 18:54
Okay I think I see what the problem is here. One: the mass of the object was just to big for some reason. When I scaled down the size of my object it was then able to stay at the left of the screen. Two: The jittering then came from the physics debugger being on. When I turned that off the jittering was gone.

Thanks for your help I didn't know about the physics step either.

Login to post a reply

Server time is: 2024-04-26 15:05:43
Your offset time is: 2024-04-26 15:05:43