Right, I'm adding my tank into the game. Easy right? Unfortunatly I can't just use a simple tank script as teh tank is to big and it would look crap to do so. So really I need suspension.
As you can see each set of tracks is on an arm (two tracks on each, so I can animate the tracks...)... basicly I'm wondering if anyone has a similar implamentation I can look at, borrow code from, or if not, some pointers on how I get information out of the engin to achive such a feet. (I assume theres some sort of way to get back the height difference between peices, or somthing?) Does anyone have any pointers?
Suspension, questions on implamentation.
Moderator: Moderators
Suspension, questions on implamentation.
- Attachments
-
- tank2show.jpg
- (145.33 KiB) Downloaded 2 times
Re: Suspension, questions on implamentation.
There is Spring.GetUnitPiecePosition, Spring.GetUnitPieceInfo etc, some are in world coordinates, some are in unit coordinates. But you do imo not need use those, afterall the script should "know" where it is has moved/turned pieces to, stored in some variables:aGorm wrote:(I assume theres some sort of way to get back the height difference between peices, or somthing?)
a = 10
Move (piece, x_axis, a)
-> The piece is at a=10, no need to read it back.
For that specific unit I would use some trig math to find out the 4 corners of the unit. Then use Spring.GetGroundHeight (x,y,z) and some more sin&cos to figure out how much to tilt each arm.
Or not even bother with sin&cos and just use some fake math like
if (leftCornerY < unitCenterY) then armMoreDown()
Do that for all corners every few frames (in a thread)
It is maybe easier if you use upright=true in the unitDef so the unit body does not tilt. You could tilt it yourself with reading Spring.GetGroundNormal (x,yz)
edit:
i knew there was something...
http://springrts.com/phpbb/viewtopic.ph ... suspension