Joh Posted March 22, 2010 Share Posted March 22, 2010 I use UPS () to calculate the exact movement of a body (GetBodyVelocity / UPS() ) but it seem to update "slowly", almost 1 update to 1/2 second, why? Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Canardia Posted March 22, 2010 Share Posted March 22, 2010 You should use AppSpeed() for entity movements. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Joh Posted March 22, 2010 Author Share Posted March 22, 2010 What AppSpeed() return exactly? I saw that dividing by UPS() i receive EXACTLY how many space the entities move.. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Canardia Posted March 22, 2010 Share Posted March 22, 2010 AppSpeed() returns the number 1.0 adjusted to the speed of the program. So on heavier scenes the number 1.0 could be 1.2 or more. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Joh Posted March 22, 2010 Author Share Posted March 22, 2010 I am sorry but how this could help me? If i set the velocity to 50 it will move 50 in one second so exactly 50/UPS().. How this appspeed can help me in this way? I'll need to know how much the entity is moving in a loop. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Canardia Posted March 22, 2010 Share Posted March 22, 2010 Ah nm, you are using physics bodies, then you don't need AppSpeed(). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Joh Posted March 22, 2010 Author Share Posted March 22, 2010 Yeah sorry, i am using bodies. So do you know how can i do for UPS? Is UPS = FPS? I got it in mind right now if it is i can calculate the FPS and use that.. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Canardia Posted March 22, 2010 Share Posted March 22, 2010 Physics movement has really nothing to do with FPS or UPS. It has only to do something with time, so you can check how much a body has moved with something like this: double vtimer=clock()+1000, vcount=0, vcur=0, vpersec=0; while(){ vcur=Length(GetBodyVelocity(body)); vcount+=vcur; if(vtimer<clock()){ vtimer=clock()+1000; vpersec=vcount; vcount=0; } DrawText(1,100,"speed per second=%f",vpersec); } Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Joh Posted March 22, 2010 Author Share Posted March 22, 2010 mmm well in some way it have to do with UPS (Update per Second) check this: C: TVec3 CalcBodyVelocity( TBody body, TVec3 &position, flt smoothing=1 ) Lua: CalcVelocity:TVec3( position, smoothing ) Calculates the velocity required to make the body reach the specified position in one second, with no damping. This can be used for precise control of body movement. Also in the example he use Flip (1) and use 60 (flip 1 should fix the UPS to 60) SetBodyVelocity(body,t.scale(60.0)) So i am pretty sure it have something to do with it.. Anyway i'll check your way too. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Canardia Posted March 22, 2010 Share Posted March 22, 2010 No it hasn't. You should never use Flip(1), but always Flip(0), since on different machines Flip(1) might not even work (if the user has force sync=off). Flip(0) quarantees that your program runs with the same speed on all machines (with AppSpeed() for non-physics movements). Flip(0) makes also the application run faster than Flip(1), regardless of the FPS. You can see this especially in heavy scenes where the FPS is less than 20. John Carmack also said that you should never use vsync, but always time-based sync. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Joh Posted March 22, 2010 Author Share Posted March 22, 2010 Nice infos. Thx. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. 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.