API Question MGROUP_ROTATE usage with vectors?

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
quick question...

is there any straightforward way to reuse the transforms for animating mesh parts to transform simple vectors as well?

i need this to reposition the wingtip navigation and strobe lights on my G42-200, which has wings that are capable of hinging up and down...


can it be done without having to manually rebuild the rotation matrix from the ref, axis and angle fields of the MGROUP_ROTATE struct? - or should i just go ahead and do that instead?

seems like a lot of redendant calculations, no? :cheers:
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,633
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Just use the OrbiterSDK for that ;)

You can create an array of position vectors for your animations and create an animation component that projects the vectors according to the animation. Just use "MAKEGROUPARRAY(vector_array)" in place of the array with the mesh groups for the animation, and "LOCALVERTEXLIST" for the mesh index. The number of meshgroups in the animation component defines how many vectors you have.

make sure the array of vectors is NOT local, and remember to not modify it after you started the animation code.

From the Black Dart:

Code:
static MGROUP_ROTATE _mainEngineDownVtx (LOCALVERTEXLIST, 
		MAKEGROUPARRAY(MainEngineRefs), 2, 
		_V(1.12,0.42,-8.42), _V(1,0,0), (float)(-90 * RAD));
 

Moach

Crazy dude with a rocket
Addon Developer
Joined
Aug 6, 2008
Messages
1,581
Reaction score
62
Points
63
Location
Vancouver, BC
right on! - that hit the nail right on the head :thumbup:

didn't know we could do that, very convenient :rolleyes:



thanks, man! - that was great help :cheers:
 

Raven

New member
Joined
Jul 4, 2011
Messages
46
Reaction score
0
Points
0
Would this work with attachment points as well?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,633
Reaction score
2,352
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Would this work with attachment points as well?

Yes, the Atlantis sample in orbiter uses such code for calculating the position of the RMS attachment. You just need to remember that it takes position vectors, and that you need to convert them into the needed direction vectors for the attachments.
 
Top