Game Development Community

Scaled player and stairs

by Joe Sulewski · in Torque Game Engine · 02/14/2005 (7:40 pm) · 15 replies

Hello,

When I add the player to my level he can go up stairs just fine. But he's way to small so I have to scale him so that's he's proportional. However, after I scale the player he no longer climbs stairs. In fact, he stops over any old bump created by the interior objects. He won't step over a 1" high bump. I'm forced to jump over everything.

When I remove the scaling he can climb stairs that are taller than the player. So what values in the player object should I adjust?

Thanks for any help

#1
02/15/2005 (7:02 am)
I believe you're looking for

maxStepHeight = 1;

in the playerData datablock in engine/game/player.cc

edit: Actually I just saw another thread that suggests you'll have to change the datablock values in

starter.fps/server/scripts/player.cs around line 619

instead of the source code.
#2
02/15/2005 (7:30 am)
Teck,

Thank you for your response. Do you know what the number refers to? For example is it a range of 0-1? What does 1 mean? I set it to 50 in the player.cs file where it defines the player datablock and it didn't do anything. Perhaps it's not exposed to the script.

I can go up the steps when the player isn't scaled but when the player is scaled I can't.

Thanks,

joe
#3
02/15/2005 (1:42 pm)
I think this is a bug in the code. I ran into the same thing a year or so ago and poked around in the player step code but couldn't find anything obvious that was breaking it. Unfortunately, I haven't had time since to look into it.
#4
02/15/2005 (8:32 pm)
Oh no. Any ideas as to what to do? Hmmm. I guess I can place clear dts objects over my stair objects but that's going to be a pain. I don't have the modeling skills to create a new player.

oh no.
#5
02/19/2005 (4:34 pm)
Don't freak out, dude. :)

Lots of scaling in general is a _bad_ idea. I would suggest scaling your interiors down in quark.
#6
02/21/2005 (4:43 pm)
I don't want to scale my interiors down because I want the detail for the terrain to be of high resolution. If I scale everything up then the size of the terrain polygons compared to the interior are proportionally smaller. This allows me to get better resolution around the interiors.

What can you tell me to keep the freak out down? ;)
#7
02/21/2005 (8:48 pm)
You could turn down the terrain squaresize?
#8
03/04/2005 (1:27 pm)
I'm doing something similiar with scaling up players and playing with the step size. I looked at the code but couldn't get anything to work either. Hopefully if someone solves it they'll post in this thread. :)
#9
01/07/2006 (10:08 pm)
I found that if i scale down the player, the problem gone, so a quick solution is to set the player scale from 0.6 to 1.1.
#10
01/08/2006 (12:13 am)
I'm with Ben, changing the terrain block size and the interiors scale is probably best and leave the player scale alone.
#11
01/11/2006 (1:33 pm)
This is an old thread, but in case anyone else reads this in the future . . .

One option is to use ramps instead of stairs and then manually place .dts stair shapes (with no collision meshes) over the ramps. That should solve the problem.
#12
12/04/2006 (3:50 pm)
Did anyone come up with a solution to this, without resorting to ramps? I'm using the player bone-resizing resource and am changing the bounding box because of this. As soon as I do though, the player no longer steps up even the smallest DTS edge.

Bizaarely, even if I set player::step to always return true, the player STILL doesn't step up!

Cheers,
Gords
#13
01/26/2007 (5:10 pm)
...
#14
02/10/2007 (5:14 pm)
I just ran into this issue too.

After some hunting I found an answer to the problem. It seems that while the collision would use the scaled collision box, the function that calculates max step height was using the original bounding box, and if the player is scaled up, this box was too small to see the collision.

The solution is to use the scaled collision box just like all the other collision calculations do.


Changes in player.cc


In Player::step() around line 2347 in TGE 1.5

box.min = mObjBox.min + offset + *pos;
box.max = mObjBox.max + offset + *pos;

becomes

box.min = mScaledBox.min + offset + *pos;
box.max = mScaledBox.max + offset + *pos;


If you want the max step to scale with the player model you will also need to change:

In Player::updatePos() Around line 2440

F32 maxStep = mDataBlock->maxStepHeight;

move it down a few lines and change it to read:

//existing line
const Point3F& scale = getScale();

//newly moved line
F32 maxStep = mDataBlock->maxStepHeight * scale.z;
#15
05/10/2013 (7:16 am)
Just updating for T3D. Still in Player::step (...)


box.minExtents = mObjBox.minExtents + offset + *pos;
   box.maxExtents = mObjBox.maxExtents + offset + *pos;

becomes

box.minExtents = mScaledBox.minExtents + offset + *pos;
   box.maxExtents = mScaledBox.maxExtents + offset + *pos;

Not entirely certain you want to modify the maxStepHeight by the scale of the player. But if you do, it is still located in the same location Jon pointed out previously.