Size / scale within the UNITY engine

Firstly I am a newbie here.

I have been reading through the tutorials over the last month and I have a question which so far has not been answered.

How does size and scale work within unity, is there a reason for choosing to scale things at a lower pr higher value? and does this affect performance?

I am wanting to model a soccer ball realistically and need advice as to the best ‘size’ to make the ball, I don’t want it to bounce/roll like a marble!

Obviously there will be soccer players as well.

Also, I realise that to make the ball bouncy I will probably need to add a component (possibly a script?)

In general, the default settings within Unity are based around the assumption that 1 unit = 1 meter. So for example, the Physics settings have gravity set to 9.81 units/sec, to match a real-world value of 9.81 meters/sec.

2 Likes

Thanks for the response.

So, for instance if I wanted to make a plane 100m squared (relative to the engine), the scale value would need to be 100x100. Correct?

If you were using realistic physics and the default values, and your plane model is normally 1x1 unit, then yes. Odds are though, you’re going to have to tweak something though to get the gameplay you want.

Just don’t go too high, or thing will start to fall apart due to the massive numbers needing to be computed (bring an object really far away from the origin, and you’ll get warnings, for example).

Thanks for the answer.

So, would you advise I scaled the numbers down then?

I am going to have 23 moving game objects (players and ball), each parenting roughly 6 trigger boxes, plus roughly another 20 trigger boxes assigned to the pitch… Is all of this possible? Plus there is AI each frame. Oh and I intend to have 22 rabbits each with a player chasing it too! Unity overload??

Just don’t make your ball the size of the Death Star.

As for the AI, it should work (I have ~12 FPS enemies all with guns blazing working fine on my computer, and that’s probably more demanding than what you’re doing), but it all depends on what exactly needs to be done by the AI each frame. I wouldn’t worry too much though.

Nice one, and I laughed at the joke!

Like I said in the OP, I am a complete newbie with regards to all aspects of game design. Just reading about the box triggers, I can accomplish what I want using primitive ones, so it should be all good.

The use of so many colliders cuts down the amount of my AI calculations, (by a process of deduction) :slight_smile:

I must also add, the community here seems really helpful already. Do well

Personally, I avoid scaling on transforms - I prefer to do all the scaling either in 3DS Max, or in the Import Settings for a model - but if you are going to scale things, try and stick to uniform scales (i.e. the same scale value on each of X/Y/Z). There’s a few places in the engine where non-uniform scaling can cause some headaches, so if you’re in the habit of only using uniform scale then you won’t run into them so much.

Another tip for ensuring proper scaling for Unity is creating a 6’x6’x6’ box in your 3d app (set the units to Meters) and import it to Unity. This is how I ensure all objects will look realistic in the engine

I don’t get it?

I think he’s referring to using a known 6m cube as a guide to getting scene scale correct, which is a bit strange really as the default Unity cube is 1m in size…

As for the OP’s question, scaling an object using the Unity Transform component will affect performance. However it won’t be much, in fact, it’s likely you’d never notice, but as a best practice you should get the scale correct through your 3D program and Unity’s import settings, rather than the transform. (This becomes difficult when using things like NGUI, or scaling at run-time, but like I said, it’s not a massive problem)

Thanks, I appreciate your help so far.

So… As a total newbie, the general theme I think I’m getting, is ‘don’t create your objects in unity’. Presumably one could use blender or another such program for that?

I am worried performance is going to be an issue, I intend to have quite a lot going on… and it’s better to learn the right way from the get go…

Also I noticed that the scale obviously is dependent upon the shapes initial dimensions, not all of the pre-made game objects are 1x1. In fact some are 1x2 and it seems as if the plane is 10x10 from what I have calculated.

Try not to scale anything. Bring the model in at the correct size. If scale is different in two axes you will get odd looking deformation when child objects are rotated. You use a PhysicsMaterial to set the bounce with.

You can make it bounce by importing Physics Materials (Assets > Import Package) and adding the Bounce material onto the Sphere Collider.

Scaling things to real world sizes won’t get you the effect you’re after, unless you’re using the Oculus Rift.

I made an FPS soccer game demo and to make it feel fun I had to make the ball a lot larger than real life and shoot slower.

If you have issues of the ball going through walls at high speeds, try scaling your level 10x larger. Just parent the entire level and scale the parent.

Yes. You might use Unity to lay your objects out, but the objects themselves are usually made in external programs. There are a couple of plugins available on the Asset Store that do various kinds of mesh editing directly within Unity if you really want, but the ‘main’ workflow is to bring models in from other programs.

Yes, that’s correct - and another reason why it’s better to create your meshes yourself, where you can configure them to be exactly what you need.

I have the free version of Blender, will take a look at that tonight.

Thanks for the advice all

Thanks for the advice…

It’s funny, for years I have been saying “The pitch on fifa is too small - or the players are too big”. Now I’m starting to understand why!

I am not using player input to directly control the on pitch players and the level of animation detail will never need to be very high…

The ball being ‘seen’ from various camera perspectives is probably the biggest issue, I have considered adding a ‘trail’ that would indicate it’s flow.

Oddly, the mock up graphic I have created in unity looks amazing with isometric view, it’s like a low-fi football version of A-Train… and that could never be a bad thing! :smile:

Some advice before I venture into Blender… Does 1 unit in blender equate to 1 unit in unity upon import?

Usually 3D apps use a specific scale unit per project. When doing industrial design I set it to inches. When making game objects I set it to meters. Check in your apps preferences. Then on import you may have to scale it to .01, 0.1 or 1.0…maybe more…but try to get it so the scaling is in 1’s or fractions like 10ths 100ths… Just because you will remain saner in the long run.

1 Like

I do strongly suggest the internal editing stuff for things like level geometry where the type of game is appropriate. It can hugely speed up your design, and help you make better stuff. Remember you can combine tools, though - just 'cause you designed in-engine doesn’t mean you can’t make things pretty out of engine in tools more appropriate for that task once the design is locked down.

General rule of thumb is… use the right tool for the job. :wink:

Spot on. Make sure things are configured elegantly on both sides before you get going, then stick to those settings and be consistent.

Make life easy for yourself. :slight_smile: