RTSUnit water physics
by BillF · in RTS Starter Kit · 01/28/2008 (9:35 pm) · 2 replies
Does anyone have any advice on how to support density/buoyancy for a water RTSUnit? I'm working on trying to get an RTSUnit ship to float on water properly. So far I have it basically sliding on top of the water block instead of hugging the terrain if flagged to do so, which works for the most part, but I have a few problems.
1) The first problem is at times when the unit reaches its destination it jumps to the terrain height on the bottom of the water instead of staying put on top of the waterblock. I suspect this is either something happening in the script or something in the "server sync", I'm not sure yet.
2) I'd like to make the unit realistically sink if damaged by increasing its density, and to support this I'll have to bring some of the buoyancy code of player.cc into the mix (probably in a new RTSWaterUnit class). Does this sound like the correct approach or are there certain things that won't work due to the movement of RTSUnits vs. the Player class? By the way I've tried this a bit already and found issues with watercoverage never being enough to be significant in changing the buoyancy, which I haven't figured out yet. I'm not sure if this is a bounding box problem with my model, or the fact that I'm starting by skipping on top of the waterblock. Or should I just handle the buoyancy by completely skipping player physics like the standard RTSUnit does and just adjust a "hover height" ad hock?
Thanks! Any insight would be great.
1) The first problem is at times when the unit reaches its destination it jumps to the terrain height on the bottom of the water instead of staying put on top of the waterblock. I suspect this is either something happening in the script or something in the "server sync", I'm not sure yet.
2) I'd like to make the unit realistically sink if damaged by increasing its density, and to support this I'll have to bring some of the buoyancy code of player.cc into the mix (probably in a new RTSWaterUnit class). Does this sound like the correct approach or are there certain things that won't work due to the movement of RTSUnits vs. the Player class? By the way I've tried this a bit already and found issues with watercoverage never being enough to be significant in changing the buoyancy, which I haven't figured out yet. I'm not sure if this is a bounding box problem with my model, or the fact that I'm starting by skipping on top of the waterblock. Or should I just handle the buoyancy by completely skipping player physics like the standard RTSUnit does and just adjust a "hover height" ad hock?
Thanks! Any insight would be great.
About the author
#2
I'll post some updates as I go..
01/29/2008 (5:07 pm)
Thanks Novak, makes sense. There's no use in getting stuck on a nicety if it holds up the big picture at this point - spit and polish can come much later. At least my problem got me into the C++ code and forced me to get a better understanding how things work in player.cc and RTSUnit.cc. But at this point I should probably be focusing on script and mission files insteadI'll post some updates as I go..
Torque 3D Owner Novack
CyberianSoftware
The thing is that you are on a philosophical crossroad. You have two options here: to implement physics on the RTSunit class (or a new class, or whatever, the point is to bring physics back to the RTS kit) or to emulate it with good animations and pretty tricks.
Both have pros and cons, but as you sure know by now, the kit desing chooses the second path, eliminating all physics fro the RTSUnit class. There were for sure valid reasons to do this, and till the moment you feel safe enough with the engine, I would recommend to use the current scaffold.
Prorotype your idea, as open as you can on the technical aspects, as is almost sure that much of what you do now, will be changed by yourself on the future, on the path of knowing better the SDK.
My recomendation is to focus on advance on the project, lefting those intresting, but more complex aspects for future iterations.
...
That beeing said, if you prefer o follow the other path, and investigate the way of bring physics back, you should read this: TGE/Player Physics, as it is a good summary of what you will need.
And if you are MAD enough, there are also very intresting articles on physics engines implementation on TGE.
Keep us informed! ;)