How to get position of a mount-node?
by Dave Calabrese · in Torque Game Engine · 01/18/2005 (11:47 pm) · 9 replies
I once heard from someone here that there is a way to retrieve the current transform of a mount node through a script command. Looking around but can't seem to find it... anyone know it?
About the author
Recent Threads
#2
Now that you know that... you probably also realize that the initial drawing of those 120 objects takes about 6 seconds. That can be easily covered through a cinematic of some sort, BUT, the transforming of the120 dummy-nodes knows better, and when I try and get the transform on just the mounted objects, it can't get a transform because, of course, they don't exist yet when the function is called! *pant-pant-pant...*
I've tried ways to get the function that creates the dummy-nodes to wait, but it dosen't like to wait for some reason. If I personally wait for the objects to finish drawing, then I can run the function in the console and it works just fine.
SO...
Since the mount-nodes always exist, if I can get the transform of those, then I'm golden.
...that make sense?
01/19/2005 (12:09 am)
I am creating 120 like objects in the world. After extensive testing, I have found the only practical way to manage this mass array of objects is to mount them (Changing their transform takes forever as they re-draw individually, however mounting allows them all to move as one). Of course, mounting does not allow for collisions, and I DO need collisions. So, I am creating dummy-objects that are NOT mounted and accept the collisions. As the 120 objects move in a set spiral, I can simply place 120 dummy nodes to pick up the collisions.Now that you know that... you probably also realize that the initial drawing of those 120 objects takes about 6 seconds. That can be easily covered through a cinematic of some sort, BUT, the transforming of the120 dummy-nodes knows better, and when I try and get the transform on just the mounted objects, it can't get a transform because, of course, they don't exist yet when the function is called! *pant-pant-pant...*
I've tried ways to get the function that creates the dummy-nodes to wait, but it dosen't like to wait for some reason. If I personally wait for the objects to finish drawing, then I can run the function in the console and it works just fine.
SO...
Since the mount-nodes always exist, if I can get the transform of those, then I'm golden.
...that make sense?
#3
I migh suggest looking up grass movement on the forums to see if you can find it. Like I said before, it's not the same thing but it is enough to get a rough idea of other directions you may go with it.
Ben Garney was taking suggestions in one of his plans about new functions for the scripting language.One that I put in was a way to cycle through objects of the same type so that you can change things like speed, direction, color etc.. for all objects of the same type.
It sure would be handy
If I'm not mistaken, there is a call to make things wait for a function to complete before they comense, but I don't have that info off the top of my head either
01/19/2005 (12:28 am)
Makes perfect sense actually. I've seen someone having a problem like that but there movement consisted of ways to make grass sway back and forth. Which in some ways is the same being that there still objects but diffrent since they did not need collision. I have the post saved in my favorites at home. I am at work so I won't be able to get a look at it for a while.I migh suggest looking up grass movement on the forums to see if you can find it. Like I said before, it's not the same thing but it is enough to get a rough idea of other directions you may go with it.
Ben Garney was taking suggestions in one of his plans about new functions for the scripting language.One that I put in was a way to cycle through objects of the same type so that you can change things like speed, direction, color etc.. for all objects of the same type.
It sure would be handy
If I'm not mistaken, there is a call to make things wait for a function to complete before they comense, but I don't have that info off the top of my head either
#4
will get the location of the mount with the mount in question being mount0
Hope that helps
Edit: like i said, im at work so that might not be right. if you look in the resources theres a windows help file that lists all script members. do a search through the get functions and see if you can find one like getmounttransform or something along the line. Since theres a getplayertransform and such, theres probably a getmounttransorm function.
I'll search when I get home if you havent found it by then
01/19/2005 (12:34 am)
$SomeSuchObject.getMountedObject(0)); will get the location of the mount with the mount in question being mount0
Hope that helps
Edit: like i said, im at work so that might not be right. if you look in the resources theres a windows help file that lists all script members. do a search through the get functions and see if you can find one like getmounttransform or something along the line. Since theres a getplayertransform and such, theres probably a getmounttransorm function.
I'll search when I get home if you havent found it by then
#5
I need to search through GarageGames here a bit... it's 5:16 in the morning where I am, so I really need to get to bed now. Tomorrow I want to try and finish up this code, however, so I'll be searching all over GG.com for some hints and using your suggestion to search for grass transformations!
Thanks for all your help!
-Dave
PS: But wouldn't it be cool if you COULD have an fxFoliageReplicator be seperated into zones, with each zone allowing for collision? Then, whenever something got in that 'zone', all the foliage in that zone would press down / move about and stuff.
01/19/2005 (2:18 am)
Tried the getMountedObject just now... it returned the objectID of the mounted object. Just for fun I wrote a quick function that would cycle through all the mount-points and return the transform, then called that at the same place I would normally call the function that places the collision-nodes. It returned a transform of "0 0 0 1 0 0 0" for everything, so no luck there just yet.. =/I need to search through GarageGames here a bit... it's 5:16 in the morning where I am, so I really need to get to bed now. Tomorrow I want to try and finish up this code, however, so I'll be searching all over GG.com for some hints and using your suggestion to search for grass transformations!
Thanks for all your help!
-Dave
PS: But wouldn't it be cool if you COULD have an fxFoliageReplicator be seperated into zones, with each zone allowing for collision? Then, whenever something got in that 'zone', all the foliage in that zone would press down / move about and stuff.
#6
In shapebase there is a function named object.getslottransform(slot) but I'm not 100 percent sure that it's related to the mount slot. Wich it might be since there is a object.getmountslot(gamebasedata) function
I've also noticed that there is a gettransform in the scene object class and since all the forementioned objects derive from that(item->shapebase->gamebase), maybe that will work?
Also, here's a link to the windows help file for all of the script functions
Click Here
01/19/2005 (7:20 am)
I noticed that in the item class there is a function Item::getLastStickyPos ( ) that tells you the location of where the item is stuck. If indeed your objects are items.In shapebase there is a function named object.getslottransform(slot) but I'm not 100 percent sure that it's related to the mount slot. Wich it might be since there is a object.getmountslot(gamebasedata) function
I've also noticed that there is a gettransform in the scene object class and since all the forementioned objects derive from that(item->shapebase->gamebase), maybe that will work?
Also, here's a link to the windows help file for all of the script functions
Click Here
#7
I believe the console function you are after is getSlotTransform.
eg.
Would fetch the transform of the node 'mount2'.
01/19/2005 (11:18 am)
@Dave:I believe the console function you are after is getSlotTransform.
eg.
%nodeTransform = obj.getSlotTransform(2);
Would fetch the transform of the node 'mount2'.
#8
Unfortunetly, it STILL did it too quickly, and was grabbing the nodes as they were being made. The confusing thing was, however, that even though I was using the "schedule" function, no matter how long I waited, it could only get the nodes of about 60 of the 120.
So, I found another solution, using some matrix rotation code someone helped with me to place them, and all is now well and good.
Now I just need to figure out how to make a projectile only collide with something if a certain condition is true... and if it's not, the projectile keeps going.
Thanks for all your help, I really appriciate it!!
01/19/2005 (1:26 pm)
That code did it, it grabbed the node!Unfortunetly, it STILL did it too quickly, and was grabbing the nodes as they were being made. The confusing thing was, however, that even though I was using the "schedule" function, no matter how long I waited, it could only get the nodes of about 60 of the 120.
So, I found another solution, using some matrix rotation code someone helped with me to place them, and all is now well and good.
Now I just need to figure out how to make a projectile only collide with something if a certain condition is true... and if it's not, the projectile keeps going.
Thanks for all your help, I really appriciate it!!
#9
01/19/2005 (10:38 pm)
Er... the behavior you're describing seems to be because the network system can't propagate that many objects at once, not due to any rendering speed issues. So if you do all this on the server-side, you should have a much easier time of it, I would imagine...
Torque Owner Charlie Malbaurn
I know of the forum refference you are speaking of and I'll see if I can dig it up