Page 1 of 1

Turrets on vessels drawing

Posted: Wed Sep 18, 2013 6:17 pm
by Iran
How does OpenRA draw the turrets on vessels like the Cruiser? How does it adjust the turret drawing for the Cruisers rotation? The turrets themselves are loose files and not part of the graphics (unlike turrets on tanks).

Posted: Thu Sep 19, 2013 4:29 pm
by Matt

Posted: Thu Sep 19, 2013 7:44 pm
by Iran
That gives me an overview of the concepts involved but not the implementation. Is there anything I could check in the code?

Posted: Thu Sep 19, 2013 8:46 pm
by Sleipnir
Cmd. Matt wrote: http://blogs.ijw.co.nz/chris/index.php/ ... sitioning/ may be outdated already though.
That had a number of limitations, and was replaced ~6mo ago with proper 3D positioning in https://github.com/OpenRA/OpenRA/pull/2887. Take a look at the Turreted trait implementation to see how it is used.

Posted: Sat Sep 21, 2013 8:25 pm
by Iran
could you give me the name of a few source code files to look at to get a grasp of the implementation? My math is pretty poor and I don't have experience with 3D math at all..

Posted: Tue Sep 24, 2013 11:36 pm
by Sleipnir
The Position method in Turreted.cs would be a good place to start, and then look up the definitions of the functions it uses (and the functions they use).

It is pretty much all 3D vector stuff, so you may have some trouble. You may be better off looking at the old code implementation described in that blog post, which is much simpler and probably good enough for your static map previews.

Posted: Wed Sep 25, 2013 8:22 pm
by Iran
I decided to go with hard-coding the y and X offsets for the turrets on units which need it, it was 3 hours of work for RA1 and I think it will be about 1.5 hours for C&C95.