tec.imp Posted May 13, 2010 Share Posted May 13, 2010 Hey there. The Wiki gives some definition of the value AppSpeed returns (60/UPS?), and in particular that it is to be used to achieve framerate-independent movement. From looking at the values returned, they seem to also be averaged/curved in some way. UpdateController produces movement speeds subject to framerate, with faster framerates producing slower movement. Multiplying the input movement vectors of UpdateController with AppSpeed produces similar results: faster framerates produce slower movements. Then again, multiplying the movement vectors with my own delta time produces this effect too, leaving me to conclude that UpdateController already factors time into its calculations by its own. This leaves me with UpdateWorld and the step size I supply - AppSpeed - which I assume is the abovementioned time factor that controllers use. However, not only does UpdateWorld(AppSpeed) not produce framerate-independent movement at controllers, to my surprise it does not seem to produce framerate-independent updates at all. This becomes evident in the fact that gravity (as measured in the speed of falling objects) is subject to framerate as well (again, faster framerates produce slower falling objects). So, how am I to achieve framerate independent movement using controllers in Leadwerks, and for that matter, world updates? Thanks in advance. Mfg Imp Quote Link to comment Share on other sites More sharing options...
Masterxilo Posted May 13, 2010 Share Posted May 13, 2010 You don't have to use AppSpeed() for controller movement as the controller is just a special physics body and the movement is achieved with forces. Use AppSpeed() as the parameter to UpdateWorld and make sure you call UpdateAppTime() every frame. Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
tec.imp Posted May 13, 2010 Author Share Posted May 13, 2010 This is what I thought. However, as I wrote, UpdateWorld(AppSpeed) doesn't work out. Of course I do call UpdateAppTime every frame. Mfg Imp Quote Link to comment Share on other sites More sharing options...
Masterxilo Posted May 13, 2010 Share Posted May 13, 2010 Hmm, it works fine for me. Do AppSpeed() and AppTime() work? Print them to the screen to ensure that they do. Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
tec.imp Posted May 13, 2010 Author Share Posted May 13, 2010 They do work, although I can't say if they work as intended. The discrepancy in resulting movement speeds (for controllers as well as for objects falling due to gravity) becomes quite apparent to the naked eye with framerates of 60 and 250, which I achieve by enabling/disabling vsync. Thanks for trying to help. Mfg Imp Quote Link to comment Share on other sites More sharing options...
Masterxilo Posted May 13, 2010 Share Posted May 13, 2010 When disabling vsync things do move to fast for like 1 second because the AppSpeed has to recalculate. But except for that, objects fall at the same speed at no matter what framerate for me. Really can't say why it doesn't work for you. Make sure UpdateAppTime() and UpdateWorld() are called once and only once per loop. Quote Hurricane-Eye Entertainment - Site, blog. 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.