gamecreator Posted January 17, 2012 Share Posted January 17, 2012 I hope I didn't miss it on the wiki but is there a way to pause physics but keep everything else going (like mouse picking, etc.)? I thought PauseApp might work but the physics keep moving. I'm using Framework. Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted January 17, 2012 Share Posted January 17, 2012 I don't know if there is an "official" way to do this... Maybe cycling through all bodies and setting the mass to 0 on pause and then, setting them back to their normal values after pause..... This is just a guess. I have no idea if it will work. Perhaps try this - On Pause: 1. Record all Velocities & Omegas. 2. Set Velocities & Omegas to 0. 3. Turn off Gravity On UnPause: 1. Set the Velocities, Omegas back to normal. 2. Turn on Gravity Neway it sounds like a messy way to do it but I guess it could work. Dadonik was trying to pause physics recently. Not sure how far he got with it. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 17, 2012 Share Posted January 17, 2012 PauseApp() pauses the application time. Make sure when you are "doing things" whilst "paused" not to update the Apptime. http://www.leadwerks.com/werkspace/topic/2591-how-to-pause-game/page__view__findpost__p__23849 Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
paramecij Posted January 19, 2012 Share Posted January 19, 2012 I simply use: // dt = AppSpeed // time_scale = 0.0 - halt, 0.5 half, 1.0 normal, 2.0 double speed ... UpdateWorld( dt * time_scale ); .. it does the trick and more, but you are using Framework, so try and replace UpdateFramework() with calls to UpdateWorld (for all 3 world layers) and don't forget to add UpdateAppTime() in there somewhere, but i'm not sure what else UpdateFramework() does, so this might not be an option.. Quote Link to comment Share on other sites More sharing options...
DaDonik Posted January 19, 2012 Share Posted January 19, 2012 I wrote my own framework and i managed to pause the physics without any memory leak or other problems. UpdateAppTime(); if (m_bIsPaused == true) { // Update each world with a stepsize of 0 -> paused mode LE2LayerPtrMapIt it = m_mapLayers.begin(); for (; it != m_mapLayers.end(); ++it) { if ((*it).second != NULL) { (*it).second->SetThisWorld(); UpdateWorld(0); } } } else { // Update each world with a stepsize of AppSpeed -> running LE2LayerPtrMapIt it = m_mapLayers.begin(); for (; it != m_mapLayers.end(); ++it) { if ((*it).second != NULL) { (*it).second->SetThisWorld(); UpdateWorld(AppSpeed()); } } } The "problem" here is that the game is still running and callbacks are still called. So it really just pauses the physics. Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted January 19, 2012 Share Posted January 19, 2012 Perhaps you could set a trigger in the callbacks that causes them to not do anything if the game is in a paused state. Just an idea Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.