Minimal Object Based on ShapeBase
by Demolishun · in Torque Game Engine · 10/28/2005 (3:14 pm) · 9 replies
What are the minimum requirements for a class based on a shapebase object?
All I want is to add some simple functionality, but I want to be able to damage the object the way you can with any shapebase. It has to work with client/server, and it has to be able to be mounted on a vehicle.
Thanks,
Frank
All I want is to add some simple functionality, but I want to be able to damage the object the way you can with any shapebase. It has to work with client/server, and it has to be able to be mounted on a vehicle.
Thanks,
Frank
About the author
I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67
#2
Do I include?:
packUpdate
unpackUpdate
writePacketData
readPacketData
IMPLEMENT_CO_NETOBJECT_V1 vs IMPLEMENT_CONOBJECT
What about doing simple rotation based animation? What functions do I need to call to update the positions of the objects? What data needs to be transferred using the pack/unpack/packet functions?
To me this is not so simple.
10/28/2005 (3:52 pm)
Yes and no.Do I include?:
packUpdate
unpackUpdate
writePacketData
readPacketData
IMPLEMENT_CO_NETOBJECT_V1 vs IMPLEMENT_CONOBJECT
What about doing simple rotation based animation? What functions do I need to call to update the positions of the objects? What data needs to be transferred using the pack/unpack/packet functions?
To me this is not so simple.
#3
But if you want to extend the networking then you need to touch the (un)packUpdate stuff. If you want it to be a control object that receives high fidelity updates, then write/readPacketData have to be touched. You always want to use IMPLEMENT_CO_NETOBJECT_V1 with any subclass of ShapeBase.
Item implements a simple rotation animation, so you might want to check that out for some ideas.
10/28/2005 (4:01 pm)
You can pretty much inherit from ShapeBase and not implement anything at all if you want. :)But if you want to extend the networking then you need to touch the (un)packUpdate stuff. If you want it to be a control object that receives high fidelity updates, then write/readPacketData have to be touched. You always want to use IMPLEMENT_CO_NETOBJECT_V1 with any subclass of ShapeBase.
Item implements a simple rotation animation, so you might want to check that out for some ideas.
#4
(un)packUpdate - networkable objects
write/readPacketData - control object (vehicle type, physics)
IMPLEMENT_CO_NETOBJECT_V1 - subclass of ShapeBase
Check out "item".
Thanks everyone,
Frank
10/28/2005 (4:07 pm)
Recap:(un)packUpdate - networkable objects
write/readPacketData - control object (vehicle type, physics)
IMPLEMENT_CO_NETOBJECT_V1 - subclass of ShapeBase
Check out "item".
Thanks everyone,
Frank
#5
Also, I seem to be missing something to position the object during animation of a node. When I call a console function to change the rotation of a node I have to actually move the object to get it to update the animation. Is there code I need to implement to get this to work.
One more thing. If I replace all references to my object with staticshape the object will mount fine where it is supposed to. If I change back to my shape it appears at position 0,0,0 of the world instead of being mounted on my object. Is this related to the position not being updated in code? Shouldn't the default take care of this? Maybe I need to look at static shape for this.
Thanks,
Frank
10/29/2005 (11:35 pm)
Okay, I have this thing mostly working. However, the script call "create" does not seem to be being called for my object. Where is create called from? I cannot see create being called in any file under the game directory. Is this something I need to do in my class? Kind of like scriptOnAdd()? Also, I seem to be missing something to position the object during animation of a node. When I call a console function to change the rotation of a node I have to actually move the object to get it to update the animation. Is there code I need to implement to get this to work.
One more thing. If I replace all references to my object with staticshape the object will mount fine where it is supposed to. If I change back to my shape it appears at position 0,0,0 of the world instead of being mounted on my object. Is this related to the position not being updated in code? Shouldn't the default take care of this? Maybe I need to look at static shape for this.
Thanks,
Frank
#6
I took the code from StaticShape and added the relative points of the Turret code to make a simple object that allows me to move the pitch and yaw from script function. However, I am missing something that I cannot quite figure out just yet.
I have a console function that allows me to modify the value of the pitch and yaw of the turret I am coding. However, it will not reflect the change in the animation unless I move the object in the sim. What do I need to do to get that change updated? Is there something I need to do with the "move" variable?
Thanks
Frank
10/30/2005 (3:06 pm)
Alright, I am almost done.I took the code from StaticShape and added the relative points of the Turret code to make a simple object that allows me to move the pitch and yaw from script function. However, I am missing something that I cannot quite figure out just yet.
I have a console function that allows me to modify the value of the pitch and yaw of the turret I am coding. However, it will not reflect the change in the animation unless I move the object in the sim. What do I need to do to get that change updated? Is there something I need to do with the "move" variable?
Thanks
Frank
#7
Tell me what the heck this does:
where:
Some of this is starting to sink in, but I guess I needed to notify something that a move was pending?
Would anyone be interested in a resource of this now that it works?
Thanks,
Frank
10/30/2005 (3:24 pm)
Yeah it works!Tell me what the heck this does:
setMaskBits(MoveMask);
where:
MoveMask = Parent::NextFreeMask << 1;
Some of this is starting to sink in, but I guess I needed to notify something that a move was pending?
Would anyone be interested in a resource of this now that it works?
Thanks,
Frank
#8
More substantial info here:
tdn.garagegames.com/wiki/TorqueNetworking
10/30/2005 (4:10 pm)
In short the setMaskBits tells the underlying networking code what needs to be sent on the next packUpdate.More substantial info here:
tdn.garagegames.com/wiki/TorqueNetworking
#9
This is great! I need to spend more time on the TDN. This explains it very well.
Thanks,
Frank
10/30/2005 (4:29 pm)
Hey Greg,This is great! I need to spend more time on the TDN. This explains it very well.
Thanks,
Frank
Torque Owner Josh Moore