Advertisement

Scaling a terrain and finding meters per second to movement

Started by November 14, 2023 10:07 PM
5 comments, last by snoken 1 year ago

Hi,

I have a terrain with a width of 199 and height of 99 and I'm scaling this train by 500. What would be 1 meter in the new terrain, would it be 500? I'm trying to move my character in meters per second and trying to figure out the correct speed amount to move him in meters per second.

I'm also trying to generate a random number for footballs, where the balls can be shot at you ranging from 30 m/s to 400 m/s but I'm quite confused on the measurements of determine m/s. I thought 500 would be correct for 1 meter in the new terrain but this would then mean I would need to generate a random value between 30*500 and 400 * 500 which seems to crash. Would appreciate any insight into this

snoken said:
I have a terrain with a width of 199 and height of 99 and I'm scaling this train by 500. What would be 1 meter in the new terrain, would it be 500? I'm trying to move my character in meters per second and trying to figure out

It would be whatever sizes you make things relative to. You (or your artist) get to decide the units for your world. The number of elements on the terrain doesn't really matter, it's all about what a unit of 1.0 looks like relative to them.

An easy approach is to set down a 1.0 unit cube in the world, determine how everything looks relative to that. It is very common for artists and designers that are building worlds out of boxes ("grayboxing", among other terms) to build up the world out of a bunch of known-size building blocks to help establish the scale for how it all will come together.

Also, if you're using an engine be aware of the scales they use. Unreal uses centimeters as the default distance unit, so a 1 meter cube is 100 unreal units or uu. Everything else is as you'd expect, m/s for velocity, mass is kilograms, and force is newtons, but for historic reasons an unreal unit is 1 cm rather than 1m. Engines can also let you change the default interpretation, either for the math they use or for the system they display when the unit is known.

snoken said:
I'm also trying to generate a random number for footballs, where the balls can be shot at you ranging from 30 m/s to 400 m/s but I'm quite confused on the measurements of determine m/s. I thought 500 would be correct for 1 meter in the new terrain but this would then mean I would need to generate a random value between 30*500 and 400 * 500 which seems to crash. Would appreciate any insight into this

That's really fast. At 30 m/s you'd cross an entire regulation ball field in 3 seconds. At 400 m/s you'd cross an entire ball field in a quarter second. A very fast ball kick from a professional player might reach 30 m/s if they really booted the ball, and it would fly by at highway speeds.

Even so, the math shouldn't crash anything. Numerically it is simply a fast moving ball.

Advertisement

@frob Thanks for the reply. I understand what you mean when you say

You (or your artist) get to decide the units for your world. The number of elements on the terrain doesn't really matter, it's all about what a unit of 1.0 looks like relative to them.

However, the situation is that the terrain had dimensions of Width: 199 and height: 99 where 1 unit was 1 meter which is defined and agreed upon but if I now scale this terrain where 1 unit = 1 meter by 500, 1 meter would now be 500 right? the main issue that I am having is that, with the footballs, the speed in m/s doesn't seem to look correct on the scaled terrain so im wondering how I can make them travel correctly in m/s on the newly scaled terrain

One way to check is to compute how long it takes to cross the entire field with some speed in the original and the scaled version. It sounds like you intend to keep all timing the same, so you can compute the same thing again after scaling, and it should give you the same values modulo some very very small rounding error.

If that is the case, your scaling is correct I think. If not there is an error somewhere.

Whether “it looks right” is another matter, by multiplying, you scaled the “off amount” too by the same factor, so errors are more visible.

If you want more detailed help give us the computations, and how you reach your conclusions from the numbers. Currently we can't even see what you do is also what we might think you're doing.

snoken said:
where 1 unit was 1 meter which is defined and agreed upon but if I now scale this terrain where 1 unit = 1 meter by 500, 1 meter would now be 500 right?

If you scale ONLY the models of the terrain, yes, that's true. It would scale all 3 dimensions to the new size and nothing would be changed around it. Any distance in any direction would be the new size.

There are many other systems involved, including all physics. There are 7 base units, and all physics constants and scales are based on those units. In the physical world, those are time (second), distance (meter), mass (kilogram), current (Amp), temperature (Kelvin), substance (mole), and luminous intensity (candela). If you start changing any unit you need to adjust ALL the constants and ratios to adjust. Games are usually only tied up around the first three, time, distance, and mass.

In Unreal Engine the base unit is centimeters instead of meters, and everything in the physics system has been calculated on centimeters. It's quite common for artists to import it once, realize that everything is 100x the size they expected, and the modify their modeling scale with centimeter settings. A developer could absolutely modify it to something else, like meters or feet or inches or furlongs or yards or rods or cubits, but by doing so they must also modify every constant and ratio.

If you have a physically accurate game simulation, all the rest will hold. If you kick a ball at 30 m/s, which is highway speeds, it should zoom away. If you launch a ball at 400 m/s which is faster than most bullets and faster than the speed of sound, that ball should travel the terrain at the expected rate, like a supersonic jet.

All the rest of physics should similarly apply. An impact with that 30 m/s ball would be as hard as a highway velocity ball smashing into something, and an impact with a supersonic ball would be an explosive faster-than-bullet impact energy.

Basically, all of it should remain intact.

Thanks for the insightful and thoughtful response. It helped me learn a lot.

This topic is closed to new replies.

Advertisement