Sign in to follow this  

Length scale in physics engine

This topic is 2844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am participating in a racing game development using PhysX. Since I did not start my work from the beginning of the project but joined it midway. I found a strange scale factor when I read the source code that my predecessor had coded. He applied the length scale factor of 10 in transfering a graphical model to the physics engine to create a corresponding physical model. I.e. 1m in the graphical model becomes 10m in the physical model. I cannot understand why he did it. It brings me irksome works. I should consider the lengthscale whenever I deal with force or energy. I tried to change the length scale factor from 10 to 1, which changed the movement of car. I guessed that some force had been coded regardless of it. I want to remove the length scale factor, but cannot have confidence of the result because I do not know why he adopted it. Is there any advantage to adopt such a length scale factor? If you use a scale factor like it, let me know why you decided to use it.

Share this post


Link to post
Share on other sites
There's no standard reason to scale by 10. It may just be a value that worked, or it may be a chosen units conversion factor. Odds are its the latter. If the programmer no longer works there, and there's no documentation of the scale chosen, then nuke it. Clear out any not understood scaling and start over. You may notice that your graphics no long align with the physics. Fix that issue, you may notice that your accelerations and forces no longer match the new scale, deal with those in time.

It doesn't make sense to proceed with undocumented magic numbers through out the code. It will slow down development and give you head aches.

I'm assuming you use source control. Save your work, then go through and remove all instances of the magic number. Within a day you should know whether your changes are for going to be usable. If not, no harm, just revert your work.

Did you try contacting the previous employee?

Share this post


Link to post
Share on other sites
- stability / precision issues (although 10 will not fix much).
- model and graphics are scaled themselves, so you need the physics to scale back for conforming to real-world data values.
- Quake 3 environments have a scaling factor involved, and iirc, the world rotated 90 degrees compared to the usual conventions (+Y should be 'up'). I think it is to do with loss of precision in shaders and z-buffer maths (altohugh I could be wrong! [grin]).
- time / gravity scaling tweaks to make the game feel more responsive (more sense of speed, more natural grip and less air through jumps).

Share this post


Link to post
Share on other sites

This topic is 2844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this