Inflate/Deflate TGEed ScaleTool
by Matthew Jones · in Torque Game Engine · 02/28/2003 (4:11 pm) · 20 replies
I was looking into trying to add a SCALE tool to the Torque Editor. Currently if you scale an item in the editor your only choice is to scale seperatly one at a time on XYZ.
My thoughts were I could just make a button that would scale up or down 1 increment (according to World Editor Settings) on all three points IE Inflate / Deflate.
The problem is the only thing I can find a reference to is the:
mouseScaleScale, MouseMoveScale. I cant find any functions to back this stuff up. I have looked through the Common/Editor folder and all the files but nothing. Looked through alot of the Source folder for the editor and plenty of hits on "Scale" But nothing that I could understand to back the scale proccess in the editor. All I really need to find the Keybind or whatever it should be for Holding CTRL & ALT and moving the mouse while holding the left button. If I could find that I am sure I could come with a HACK that would do the trick.
I am probably taking a long shot posting but I am clueless. So I am hoping some one might have an idea as to where to go.
Thanks
Matt
My thoughts were I could just make a button that would scale up or down 1 increment (according to World Editor Settings) on all three points IE Inflate / Deflate.
The problem is the only thing I can find a reference to is the:
mouseScaleScale, MouseMoveScale. I cant find any functions to back this stuff up. I have looked through the Common/Editor folder and all the files but nothing. Looked through alot of the Source folder for the editor and plenty of hits on "Scale" But nothing that I could understand to back the scale proccess in the editor. All I really need to find the Keybind or whatever it should be for Holding CTRL & ALT and moving the mouse while holding the left button. If I could find that I am sure I could come with a HACK that would do the trick.
I am probably taking a long shot posting but I am clueless. So I am hoping some one might have an idea as to where to go.
Thanks
Matt
#2
Do you have a bug number to go with that? i.e. Did you or someone else submit it?
02/28/2003 (5:31 pm)
Conrad,Do you have a bug number to go with that? i.e. Did you or someone else submit it?
#3
Being Blond is a CURSE
Thanks Conrad you allowed me to see the light even though you didn't mean to.
The other problem I was having was trying to do a dump on the object when I didn't have it named.
LOL
Matt
02/28/2003 (5:32 pm)
Oh Man I feel stupid. I have spent about 2 months in and out of that editor and never noticed I could just TYPE in the scale.Being Blond is a CURSE
Thanks Conrad you allowed me to see the light even though you didn't mean to.
The other problem I was having was trying to do a dump on the object when I didn't have it named.
LOL
Matt
#4
I'm really disappointed in you! ;) I mean, you knew how to use but not to scale...hmmm
Had to poke you for that!
E-d
02/28/2003 (5:37 pm)
Matt,I'm really disappointed in you! ;) I mean, you knew how to use
Had to poke you for that!
E-d
#5
02/28/2003 (11:07 pm)
Nope, haven't submitted it formally as a bug yet. I wanted to verify that I wasn't just seeing things, and if possible, try out a solution for it.
#6
Matt
03/01/2003 (6:32 am)
I seen it happen. My programmer looked through the code a bit but he couldn't figure out why it didn't update. Kinda looks like at the same time you fix that you might fix the problem of "Moving things Manually" and the transform not being updated. That would be somthing worthwile to fix or have fixed.Matt
#7
03/01/2003 (9:32 am)
Note, in the GUI Editor if you move controls, their values DO get updated in the Inspector, so is definitely possible. Someone probably just forgot to enable something in the Mission Editor.
#8
To fix this is fairly easy. I've already done it for a number of objects for our game "Strategem".
Essentially, what is not being done in all circumstances is the server object updating the client. Each object can handle this individually but there is a group of common objects that do it the same although it doesn't take much effort to go through all the objects and get them to update.
As an example, the objects; "Item", "MissionMarker", "StaticShape", "Vehicle" and "WheeledVehicle" all use a mask called "PositionMask". What is required for these objects is to set this mask-bit when the user hits apply. To do this, add the following public virtual function to the appropriate C++ class (if it's not already there) ...
Other classes typically embed the appropriate transform update to the client in other mask names. Simply find the appropriate one and add the previous code to it.
Easy Peezy, lemon squeezy. :)
- Melv.
03/01/2003 (10:16 am)
Guys,To fix this is fairly easy. I've already done it for a number of objects for our game "Strategem".
Essentially, what is not being done in all circumstances is the server object updating the client. Each object can handle this individually but there is a group of common objects that do it the same although it doesn't take much effort to go through all the objects and get them to update.
As an example, the objects; "Item", "MissionMarker", "StaticShape", "Vehicle" and "WheeledVehicle" all use a mask called "PositionMask". What is required for these objects is to set this mask-bit when the user hits apply. To do this, add the following public virtual function to the appropriate C++ class (if it's not already there) ...
void XXXXXXX::inspectPostApply()... and add put within this function (in the case for these classes) ...
setMaskBits(PositionMask);... and hey presto, instant updates.
Other classes typically embed the appropriate transform update to the client in other mask names. Simply find the appropriate one and add the previous code to it.
Easy Peezy, lemon squeezy. :)
- Melv.
#9
I've been trying to fix the problem, and I've got it to pass the scale, but the player's camera and eye vectors and the collision mesh for the vehicle he's riding remain the same size after the scale change, so I need to find out how to update those properly.
03/01/2003 (11:39 am)
Hey, Melv, is that to address moving stuff around only, and not rescaling them? The example code from item.cc looks like it only deals with the position of the object, and not changing the scale.I've been trying to fix the problem, and I've got it to pass the scale, but the player's camera and eye vectors and the collision mesh for the vehicle he's riding remain the same size after the scale change, so I need to find out how to update those properly.
#11
Hope it helps. :)
- Melv.
03/02/2003 (4:57 am)
Although it refers to position, it's actually the whole transform that's being passed which obviously includes the scaling. I must admit to not actually looking at the item class but this is the route forward to fix the problem.Hope it helps. :)
- Melv.
#12
This is exactly what I was curious about just the other day, I have to (identical) interior objects laid end to end (one is rotated 180 degrees) and the rotated one is just a little higher in Z but you'd never know that from it's inspector.
Thanks!
- Brett
03/02/2003 (8:25 am)
Melv, if you have info on how to add this to Interior objects, please do share!! :-)This is exactly what I was curious about just the other day, I have to (identical) interior objects laid end to end (one is rotated 180 degrees) and the rotated one is just a little higher in Z but you'd never know that from it's inspector.
Thanks!
- Brett
#13
I've not looked at Interiors (as we don't use them in Strategem) so I checked it out for you a few minutes ago and it seems to suffer from the same problem as the other objects.
Change the function ...
If life were simpler I would spend the time and go through the objects one by one and sort out daft issues like this.
Hope this helps for now though. :)
- Melv.
03/02/2003 (10:35 am)
Bret,I've not looked at Interiors (as we don't use them in Strategem) so I checked it out for you a few minutes ago and it seems to suffer from the same problem as the other objects.
Change the function ...
void InteriorInstance::inspectPostApply()
{
if((mAudioProfile != saveAudioProfile) || (mAudioEnvironment != saveAudioEnvironment))
setMaskBits(AudioMask);
}... to ...void InteriorInstance::inspectPostApply()
{
if((mAudioProfile != saveAudioProfile) || (mAudioEnvironment != saveAudioEnvironment))
setMaskBits(AudioMask);
// Update the Transform on Editor Apply.
setMaskBits(TransformMask);
}If life were simpler I would spend the time and go through the objects one by one and sort out daft issues like this.
Hope this helps for now though. :)
- Melv.
#14
Once I sort out the remaining scaling issues (eye and camera vector, nametag height, player leaves normal-sized decal) I'll put up a patch. :)
03/03/2003 (12:19 am)
Okay, I've worked out the two major scaling issues: I found the bug where vehicles didn't collide correctly after being scaled, and the one where players don't collide correctly likewise. (they each have their own idiosyntratic collision systems; ShapeBase and TSStatic work perfectly fine)Once I sort out the remaining scaling issues (eye and camera vector, nametag height, player leaves normal-sized decal) I'll put up a patch. :)
#15
- Brett
03/03/2003 (1:14 pm)
Thx Melv... I was looking at the Interior base class.. duh. Oh well, thank god someone knows what they're doing.- Brett
#16
Just outa curiosity why would you scale a player / vehicle ? I am not positive but won't this affect tha animations? Or have checked that as well.
Matt
03/03/2003 (2:24 pm)
@Conrad Just outa curiosity why would you scale a player / vehicle ? I am not positive but won't this affect tha animations? Or have checked that as well.
Matt
#17
The most likely use for rescaling players is being able to create enemy monsters that can have different sizes and textures. Sure, it's cheap and the player might prefer to see new monsters, but it's cheap meaning that independent game designers who don't have a lot of time to make models or money to hire modelers can have an easy way to add some variation to their games.
03/03/2003 (2:30 pm)
The animations looked fine, at least for walking and jumping about. I didn't test equipping a weapon, and I probably should.The most likely use for rescaling players is being able to create enemy monsters that can have different sizes and textures. Sure, it's cheap and the player might prefer to see new monsters, but it's cheap meaning that independent game designers who don't have a lot of time to make models or money to hire modelers can have an easy way to add some variation to their games.
#18
03/03/2003 (7:33 pm)
Conrad - very slick idea really. Look forward to seein' your patch - I'll be slappin' that puppy on TZ for the target practice mode :-)
#19
MAtt
03/04/2003 (4:36 am)
OK that makes sense that kinda thing alkready happens in a few other game engines. AS long as it doesn't mess up the animations and the all the nodes (mountpoints) then it would be a good thing. Good luck on that.MAtt
#20
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3977
03/07/2003 (11:09 am)
I've submitted the resource and the patch for dynamic player/vehicle/object scaling; you can see the resource here:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3977
Torque Owner Conrad "Lynx" Wong
The only problem is that there's a bug that doesn't pass the change down to the client from the server. You'll see the object change if you then drag the object a bit, moving it, because that triggers a special editor command 'applyClientTransforms' that applies the same transform/scale to the client object as the server object has.
I described this bug in my post on the bugs forum, 'Dynamic Object Scale', but am not quite sure what the best way to fix it is yet.