Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline s990we  
#1 Posted : Sunday, February 19, 2012 10:33:36 PM(UTC)
s990we

Joined: 8/24/2011(UTC)
Posts: 7

Why can't I get an object to go faster than ~FPS*2?

Its not very fun when you can fly as fast as your bullets... Glare

Wall of code (example)


This is tested with Farseer, I am not sure if the other engines have this problem or not.

Edited by user Sunday, February 19, 2012 10:39:18 PM(UTC)  | Reason: typo

Wanna join the discussion?! Login to your forum accountregister a new account. Or Connect via Facebook Twitter Google

Offline Benjamin  
#2 Posted : Monday, February 20, 2012 3:45:25 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Hi s990we,

First of all, why do you limit your application to 60fps? If you allow more, you will obviously get more physics steps per second!

Other than that there are currently 2 ways of increasing the number of times the physics is updated per frame:

1. Change it in your physics implementation (e.g. Delta.PhysicsEngines.Farseer, needs source code of course):
Code:

		#region UpdateSimulation
		/// <summary>
		/// Perform Farseer simulation step.
		/// </summary>
		protected override void UpdateSimulation(float timeStep)
		{
			// Update profiling update time also
			profilingInfo.UpdateTime = farseerPhysicsWorld.UpdateTime;

			if (IsPaused == false)
			{
				// Run 5 time steps with 1/5 time of the frame each 
				for (num=0; num<5; num++)
					farseerPhysicsWorld.Step(timeStep/5.0f);
			}
		}
		#endregion


2. If you don't want to change any physics implementation you can just call
Code:

Physics.Instance.Run()

multiple times in your game code (remember that it will be executed once automatically, the more you call the more physics time will pass, so you might need to modify your values as well).

I hope that helps. There also was some code for fixed time steps, but I guess it is commented out because I cannot find it. We still have 17+ physics features planed for v0.9.6+, it is probably in there ..
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2018, Yet Another Forum.NET
This page was generated in 0.053 seconds.