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 / normalizing speed of physics objects

Author
Message
Sinistar99_2
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location:
Posted: 19th May 2012 00:58
I'm having trouble normalizing the speed of my one physics object .. namely the mini-golf ball. It uses physics and impulse is added to hit it, but when the game is slowed down for whatever reason it really affects the force on the ball which affects the game play drastically.

What's the best way to normalize the speed of a physics object regardless of the frame rate?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th May 2012 01:13
Physics speed is timer based. Are you sure you are only adding the force once? Maybe it would be best to set the velocity of the sprite when it is hit and then to leave it alone? It will react in a natural way to obstacles after it's speed has been set...

Sinistar99_2
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location:
Posted: 21st May 2012 07:54
That's what I do (apply the force once and let it go) however I think the friction the physics dampening is applied not in such a timer based way. At least that's how it appears to be behaving.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st May 2012 10:54
That's interesting. Perhaps you could provide some sample code? If it appears to be a bug I'll add it to the bug board...

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st May 2012 12:45
I had a similar issue but it was me that was the problem.
I have a slow Android phone and things went too fast. I discovered that I was applying multiple forces, and the frame rate meant I was applying the overall force with much less impact because of the delay. e.g

Check your code and look for areas where your code is affected by frame rate. I can say from experience that frame rate is not an issue for the built-in Physics system. I plotted the data on a line graph for different systems, and it's very accurate even across different frame rates.

Sinistar99_2
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location:
Posted: 22nd May 2012 02:46
That is reassuring. I'll go over my code, and see if maybe I'm updating something. Thanks!

Login to post a reply

Server time is: 2024-04-27 12:47:31
Your offset time is: 2024-04-27 12:47:31