Game Development Community

Linked list

by Mehmet Kizil · in Torque Game Engine · 01/14/2004 (5:43 pm) · 4 replies

Sorry if this sounds dumb, but i need some help.

Ok i have an object which is a child of sceneObject, which is fine to add to the world and it works and stuff. I now want to make a list object that can also be added to the world
which initially contains one of my objects, placed at the point in the world that the list was created. Now I want to make a script command say appendToList(x,y,z) with x,y,z being the distance away from the previous node, which places a new object in the list and thus renders it as well.

Can someone please get me started. I tried making my new object a child of shapeBase as it contained some functions i wanted to use. I stripped it of almost anything, so it did nothing but can still be added to the world. Now I made my head and next variables, and made them null in my constructor, and I figured that the onAdd() function is where i would setup my first node,
ie. mHead = new Object(); ??? and I just figured that once the new object was created that it would begin running its own functions and render and stuff. Does this sound right? could someone please help me with the code if they have some spare time?

Ta.

#2
01/14/2004 (7:20 pm)
Thanks for that,

i still can't seem to get my list working though?
Will my object render if i simple call the register function, after ive created it.
In my onAdd() function of my list I have mHead = new fxRenderObject();
then on the next line i have mHead->registerObject();
So I am hoping that when i add a new list to the world, it will have an fxRenderObject at the point of where I created the list.

Help Please
#3
01/14/2004 (9:03 pm)
Me Again,

Ok I can finally get my object to become the head of my list, but for some reason
the position it creates the list is totally different to the position of the first object?
Any ideas?

They both use mObjToWorld, would that be different for both objects, even though i make my head object within the onAdd of the list?

Just so you understand. The nodes are completely seperate objects from the list. So I,
just figured i should make a setTransform function within the node class, and call that after i call registerObject....?

ie.
mHead = new fxRenderObject();
mHead->registerObject();
// call to function to change position to the same position as the list
mHead->setTransform(getTransform()); <-- this is what I need help with....

thanks again
#4
01/14/2004 (10:00 pm)
Last things, this is werird...

Ok I add my list to the world, it puts the list somewhere and the object at 0,0,0....
now if i move the list gizmo the object does not move, however if i select the actual head node object (the one at 0,0,0), and the select the list and move it, the node moves with it now??
WTF?