Game Development Community

Torque 3D - About lowering player scale

by Konrad Kiss · in Torque 3D Professional · 05/01/2009 (4:08 am) · 14 replies

I generated a new project, and opened the default "simple" level. Compared to the terrain's features, the player character seemed really big, so I tried scaling it down to 0.3 0.3 0.3.

The player was scaled without problem, yet it failed to collide with objects and the terrain occasionally (especially at high speed). The more I scaled it down, the more probable it was for it to fall through the terrain.

I understand that this is related to polysoup and it having a problem doing collision detection on small faces, but it would be really nice to have this ability since the terrain is not scalable.

Maybe there's an alternative to solving this problem that I'm not aware of, in that case, please let me know how I could change the relative scale difference between my player model and the terrain to get the best results.

#1
05/01/2009 (11:17 am)
It's very likely scaling a player object breaks his collision somehow.

Although the terrain does not use polysoup collision, it uses regular torque convex style collision. You can change the scale of the terrain by changing its texels per meter field.
#2
05/01/2009 (11:26 am)
Best way to fix this is to set the scale of the object within the exporter you are using (i.e max2dts exporter, or Milkshape dts exporter/plus). Scaling your terrain down with your character is one option like James said, but if you want to keep your terrain scaled the same, then just adjust the scale within your exporter of choice.
#3
05/01/2009 (11:47 am)
Scaling the player down past a certain point has always "broken" collision with any version of Torque -- it's not just a polysoup or terrain thing. Best fix has always been to scale the model before exporting for use in Torque.
#4
05/01/2009 (1:39 pm)
Allright, thanks guys, I guess I'll have to go with the texels per meter setting. Sounds good. I'll edit the title so it's not handled as a bug.
#5
09/23/2012 (1:17 am)
" scale the model before exporting for use in Torque."

that is a solid solution but
this is much quicker for programmer with lots of model:
%player = new Player() {
dataBlock = LightMaleHumanArmor;
client = %this;
scale = "5 5 5";
};


so konrad,did u find any solution of that collision problem?
#6
09/23/2012 (1:27 am)
Scaling the terrain up worked I think (not the model, but the import settings), although when I started this thread it was a different terrain iirc.

Scaling any model becomes risky using extreme values, since they tend to lose collision precision (happens to all models in general. When scaling up, the larger faces your model has the earlier it happens).

Right now I have a 512x512 terrain with a square size of 4 or 5 and a max height of 100. This seems to work out well, though it heavily depends on the genre of your game.

Scaling the player is also a great way to add some variety to your models.
#7
09/24/2012 (11:34 am)
To echo Konrad: Avoid extreme scaling values, and you should be fine. I've scaled both player and vehicle models between 50% and 200% and not had any issues. If you need more than that, do the scaling in your modeling app.

#8
09/24/2012 (11:39 am)
I had similar problems with falling players when scaled.
All I had to do is to reconstruct the object box, transform and rescale the convex of player.
Then reset the working list, reset the world box and call onScaleChanged().
This one for the server and again for the client object.
#9
09/24/2012 (12:21 pm)
i actually was thinking to do something different.
something like this:
"If you need more than that, do the scaling in your modeling app."

a scaling option in shape editor.scale it.save it.auto reload it in world editor.
i think for collada it will not be tough.not sure about dts files.

just wanted to make sure that if this script side scaling have any side effect.
now i know it have side effects.so i have to think on them.
thanks for providing all those info
#10
09/24/2012 (12:47 pm)
Rescaling 3rd party content in-game just to fit has always been a stop-gap measure. Doing so as a game mechanic, if not taken to extremes is useful.
#11
09/24/2012 (2:40 pm)
Quote:Doing so as a game mechanic, if not taken to extremes is useful.
Off-topic, I came up with this awesome idea the other day for a game where your scale depends on your world position. Might save it for some other time...
#12
12/26/2012 (9:19 am)
i had this problem with a cple models i imported. they went to the bottom of the terrain instead of on top. the solution i had was simple , i clicked the model and then clicked snap to terrain. after that every time i started the game, it was on top of the terrain.
#13
12/26/2012 (3:39 pm)
@Daniel,
This sounds like an interesting way to make a level look huge. You shrink as you move toward the edge of the map and everything is scaled from the center of the map. You would also reduce the speed of everything at the edge of the map too to be in line with the new size. This could totally be an interesting experiment. It could be called the "Wonka Room Effect". After all, game programming is all about illusion!
#14
01/18/2016 (5:01 am)
Old thread is old. Still, its the first result when you google "torque3d player scaling", so I am posting this here.
In player.cpp in the Player::_move function at line 4670-ish, change
if (mFabs(distance.x) < mObjBox.len_x() &&
          mFabs(distance.y) < mObjBox.len_y() &&
          mFabs(distance.z) < mObjBox.len_z())
      {
to
if (mFabs(distance.x) < mScaledBox.len_x() &&
	  mFabs(distance.y) < mScaledBox.len_y() &&
	  mFabs(distance.z) < mScaledBox.len_z())
      {

This won't help with the other scaling problems, but the collision ones seem to be gone. I used a character scaled to 1/20th of its normal size without issue.