Game Development Community

Dynamic object scale not passed to client?

by Conrad "Lynx" Wong · in Torque Game Engine · 02/28/2003 (12:36 am) · 3 replies

It looks like if you create a new object of any kind on the fly with a scale other than (1, 1, 1):

// Set up the player
%player = new Player() {
dataBlock = LightMaleHumanArmor;
client = %this;
scale = "0.1 0.1 0.1";
};

Then the scale will be fine on the server side (it will believe the object is 0.1 the model size in all directions) but on the client side, the player is still scaled at 1.0 1.0 1.0.

The problem appears to be that Player::packData() calls ShapeBase::packData() (which is fine) but then it calls up to SimDataBlock::packData() which is not packing any data. That means that it's not sending the scale, which is stored in sceneObject.cc.

But, scaling works fine for objects that are defined in the .mis file. So I'm a bit confused as to why this might be the case.

What is the recommended fix here?

Thanks in advance--
-- Conrad

#1
02/28/2003 (9:20 am)
Update: it appears that the reason TSStatic works, for being rescaled, is that it actually includes the scale and transform as part of its packet data.

I also stepped through how the editor works, because when you resize an object through the editor, say, setting the scale and then clicking Apply, then dragging the object, it is only when WorldEditor::applyClientTransforms is called that it applies the same transform and scale to the client object as is possessed by the server object.

So, probably the most reasonable thing to do is to extend ShapeBase to pass along the scale in packing and unpacking the scale. ShapeBase will need to look at the SceneObject to determine if the scale was changed since the last time so as to avoid sending the scale every time.

What do you all think?
#2
03/01/2003 (8:14 am)
Okay, I've tried this, and discovered that it runs into the following problems:

The collision mesh for the object is still treated as if at model scale. So are the camera and eye views.

Also, by applying 'transform', the camera is tilted 90 degrees of where it should be. This can be fixed by changing camera viewpoints, i.e. hitting F8 or F7, but suggests that there's code that's being run to further transform the camera position.

Probably this doesn't mean that sending the scale or transform is a bad idea, but that they are not completely or correctly resetting the object. And maybe that the mesh coordinates or eye coordinate etc. are not being reset.
#3
08/17/2005 (12:32 am)
I am also having the same issues with dynamic scaling. Did you ever come up with a solution? If so, can you please post your solution.

Thanks