Updating world editor "axis gizmos"
by Drew Parker · in Torque Game Engine · 09/16/2004 (9:32 am) · 13 replies
Hi all,
Has anybody done any work on updating the object axes that can be clicked and dragged in the mission editor? I've always found them to not work quite right, often I click on an axis and it doesn't do anything, or I mouse over some part of the object that is nowhere close to any of the axes, but one of them hilites as if I moused over on it.
Anyway, the reason I'm asking is I'm implementing something in my project like this, and I'm building off what's in worldEditor.cc, but the logic in there for selecting the axis doesn't seem to be working right. I searched the GG site and googled it but couldn't find anything.
Is anyone interesting in working on this with me? It be nice to have these things working correctly in the mission editor (and for my project), and of course I'd be willing to post what I find as a resource if someone can point me in the right direction.
If I make any progress in the meantime I'll post it here.
Thanks,
Drew
Has anybody done any work on updating the object axes that can be clicked and dragged in the mission editor? I've always found them to not work quite right, often I click on an axis and it doesn't do anything, or I mouse over some part of the object that is nowhere close to any of the axes, but one of them hilites as if I moused over on it.
Anyway, the reason I'm asking is I'm implementing something in my project like this, and I'm building off what's in worldEditor.cc, but the logic in there for selecting the axis doesn't seem to be working right. I searched the GG site and googled it but couldn't find anything.
Is anyone interesting in working on this with me? It be nice to have these things working correctly in the mission editor (and for my project), and of course I'd be willing to post what I find as a resource if someone can point me in the right direction.
If I make any progress in the meantime I'll post it here.
Thanks,
Drew
About the author
#2
09/16/2004 (8:47 pm)
This will be really helpful, selecting the right object axes can be real frustrating sometimes - especially for large objects. This should really get checked in as soon as possible. Thanks a lot!
#3
Glad to be of help. :) If you get a chance to try it out, please let me know if it works for you. It's nice to verify bug fixes on more then one machine when possible.
09/16/2004 (9:40 pm)
Hi Vijay,Glad to be of help. :) If you get a chance to try it out, please let me know if it works for you. It's nice to verify bug fixes on more then one machine when possible.
#5
09/17/2004 (1:53 am)
Forgot to mention to inlucde game/game.h :)
#6
Your original method must be something like this:
My proposition for a more tight and less hackish solution is to change the above to:
Enjoy!
PS: Thanks Drew for getting the ball moving on that! It has annoyed me since the v12 days ;)
09/17/2004 (1:59 am)
If you allow me gentlemen, I would like to come up with a better solution for this.Your original method must be something like this:
bool WorldEditor::collideAxisGizmo(const Gui3DMouseEvent & event)
{
if(!mAxisGizmoActive || !mSelected.size())
return(false);
// get the projected size...
SceneObject * obj = getControlObject();
if(!obj)
return(false);
//
Point3F camPos;
obj->getTransform().getColumn(3, &camPos);
...My proposition for a more tight and less hackish solution is to change the above to:
bool WorldEditor::collideAxisGizmo(const Gui3DMouseEvent & event)
{
if(!mAxisGizmoActive || !mSelected.size())
return(false);
// get the projected size...
GameConnection* connection = GameConnection::getServerConnection();
if(!connection)
return false;
// Grab the camera's transform
MatrixF mat;
connection->getControlCameraTransform(0, &mat);
// Get the camera position
Point3F camPos;
mat.getColumn(3,&camPos);Enjoy!
PS: Thanks Drew for getting the ball moving on that! It has annoyed me since the v12 days ;)
#7
@ Both - Thanks to both of you for getting this fixed. That used to annoy the hell out of me also. Makes me wonder why this never got fixed before, lol.
09/17/2004 (4:28 am)
@ Xavier - I just tried your code and it works great.@ Both - Thanks to both of you for getting this fixed. That used to annoy the hell out of me also. Makes me wonder why this never got fixed before, lol.
#9
09/17/2004 (6:56 pm)
Nice job guys, much needed fix!
#10
Dude, I just realized that thanks to your fix, not only have you fixed the axis gizmos to work correctly, but your fix also allows me to reach through terrain(something I used to dream about when having to dive under terrain to retrieve objects) and I can even reach through a tree and grab an item(instead of having to go around the damn things)
In other words, your fix is "Da Bomb" and I freakin love it.
Thanks again.
09/20/2004 (9:48 pm)
@ XavierDude, I just realized that thanks to your fix, not only have you fixed the axis gizmos to work correctly, but your fix also allows me to reach through terrain(something I used to dream about when having to dive under terrain to retrieve objects) and I can even reach through a tree and grab an item(instead of having to go around the damn things)
In other words, your fix is "Da Bomb" and I freakin love it.
Thanks again.
#11
09/21/2004 (5:32 am)
Wow, working good ! Thanks much guys, really appreciate.
#12
01/29/2005 (12:07 pm)
Yes, works very well... highly recommended.
#13
Change GameConnection::getServerConnection() by GameConnection::getConnectionToServer()
07/22/2005 (5:06 am)
It doesn't work with the head (22.07.05)Change GameConnection::getServerConnection() by GameConnection::getConnectionToServer()
Torque 3D Owner Drew Parker
The culprit is in WorldEditor::collideAxisGizmo(...) in worldeditor.cc
Change this line near the top of the function:
bool WorldEditor::collideAxisGizmo(const Gui3DMouseEvent & event) { // .... // Point3F camPos; obj->getTransform().getColumn(3, &camPos); // ....To this:
// ............ MatrixF mat; Point3F vel; Point3F camPos; if ( GameGetCameraTransform(&mat, &vel) ) { //get the camera position Point3F pos; mat.getColumn(3,&camPos); } else return (false); // ................The old behaviour made it very hard to grab the axis gizmos, from my tests it seems you have to place the mouse somewhat higher then where the gizmos render to grab them.
With this new bit of code, mousing over right on the axis will do the trick.
I traced through the code which calculates if there was an intersection (not shown in the above code block) and couldn't find any problems, so I looked elsewhere and wondered if that line about the control object should be grabbing the camera instead, and it turns out it should be. I can't take the credit for the new code, I grabbed that from the Object Selection Resource (what a great resource :)
Hope this helps somebody, please let me know if you see any mistakes in this or any improvements that can be made.
Thanks,
Drew