AggrorJorn Posted October 23, 2010 Share Posted October 23, 2010 I am having trouble getting many different animations and camera settings to have the same speed no matter what the FPS of the game is. Here is an example of what I am doing at the moment: UpdateAppTime() --Rotate object if KeyDown(KEY_E)==1 then object:Turn(Vec3(0,obj.Rotation.y + (0.2 / AppSpeed()),0)) elseif KeyDown(KEY_D)==1 then object:Turn(Vec3(0,obj.Rotation.y - (0.2 / AppSpeed()) ,0)) end fw:Update() fw:Render() Updated values for rotation etc always use a 'divide by AppSpeed() ' to have the same amount rotation no matter what the FPS. What do I need to do here to get the same rotation no matter what the FPS is? Quote Link to comment Share on other sites More sharing options...
Canardia Posted October 23, 2010 Share Posted October 23, 2010 You need to multiply by AppSpeed(), not divide. By dividing you only make the FPS speed effect worse And you should also not call UpdateAppTime(), since Framework does that already. 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...
AggrorJorn Posted October 23, 2010 Author Share Posted October 23, 2010 Thanks for the quick reply Lumooja. You need to multiply by AppSpeed(), not divide. ow... well thats just really sad. I have been doing that since I bought LE. lolz By dividing you only make the FPS speed effect worse Thanks for extra illumination on the matter. And you should also not call UpdateAppTime(), since Framework does that already. Did not know that either. Well learned a lot here today. thx again Quote Link to comment Share on other sites More sharing options...
Raul Posted October 23, 2010 Share Posted October 23, 2010 I also used "/" I think I took that from Aggror. Thank you Lumooja. Quote i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64 rvlgames.com - my games RVL Games Facebook Page, YouTube Channel Blitzmax Link to comment Share on other sites More sharing options...
Raul Posted October 25, 2010 Share Posted October 25, 2010 I think I have an issue. In c# I used: //rotation by mouse int mx = Leadwerks.Graphics.Width / 2; int my = Leadwerks.Graphics.Height / 2; dx = Leadwerks.Math.Curve((Leadwerks.Mouse.X - mx) / 4, dx, (float)(3 / Timing.Time)); dy = Leadwerks.Math.Curve((Leadwerks.Mouse.Y - my) / 4, dy, (float)(3 / Timing.Time)); I tried to use 0.2 * Timing.Time but I only have a blank screen... Quote i5 2.7Ghz, GTS 450, 8GB Ram, Win7 x64; Win8 x64 rvlgames.com - my games RVL Games Facebook Page, YouTube Channel Blitzmax Link to comment Share on other sites More sharing options...
VeTaL Posted October 25, 2010 Share Posted October 25, 2010 And what about animation: i cn share my code (probably its not a new for Aggror, but anyway, it can be usefull for others) Inside main loop: float CurrentTime = AppTime(); _deltaTime = (CurrentTime - _elapsedTime) * 0.001f; Inside animation loop: _desiredAnimationFPS = _weaponAnimation->GetAnimationSpeed(); float dframe = _desiredAnimationFPS * _deltaTime; dframe = Clamp(dframe, 0.000, 1.50); dframe = dframe * ( 1 + 0.6 * (_currentAnimationSegment->getName() == "run") + 0.5 * (_currentAnimationSegment->getName() == "fire")); In this case, if we need to play animation 20 frames per second and we have 40 fps, we would play 0.5 animation frame per game frame. If we would have 20 game fps, animation would be updated by 1 animation frame per game frame. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Chris Paulson Posted October 26, 2010 Share Posted October 26, 2010 I base my animation speed on the distance travelled by the entity so as to prevent foot sliding. Gives a better effect than "guessing" frame frig factors. Quote Link to comment Share on other sites More sharing options...
VeTaL Posted October 26, 2010 Share Posted October 26, 2010 Hey, you're back How is your IK project? You worked on blending, as i remember? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Chris Paulson Posted October 26, 2010 Share Posted October 26, 2010 Hey, you're back How is your IK project? You worked on blending, as i remember? It's still ongoing and it's getting closer. I've redone my navmesh code to get rid of opensteer and use the new RVO/steering in recast as it handles crowds better. My character can walk around and place it's feet on the terrain with 80% success. I just need to handle extreme slopes and stairs better. The blending of idle/walk/runs are now fairly smooth with minimal foot sliding. There's still plenty of work to be done and it all comes down to how much time I can find. I crashed my rally car this weekend so I need to spend time on repairing that Quote Link to comment Share on other sites More sharing options...
VeTaL Posted October 26, 2010 Share Posted October 26, 2010 First time i thought about Leadwerks rally car Okay, i PM you, and good luck with repairing. Quote Working on LeaFAQ 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.