Geonovast

Need help with initRotation and nodes in MM patch

Recommended Posts

I've been fiddling around with making a group of patches to add some attachment nodes to some stock parts.  I think I got it all figured out, except for the two larger landing legs.

The rotation is causing me issues.  After changing parameters in initRotation and node_stack_top for awhile, I finally got them to basically line up ok..... from one direction.

You can see that one of these is obviously fine, which is the default position that I was testing with.  When I use 'W' or 'E' to rotate, the part looks fine, until I attach it to the node.

27dscreenshot0.png

3fascreenshot1.png

Here's my patch:

@PART[landingLeg1]
{
    node_stack_top = 0.0, 0.0, 0.02, 0.0, 0.95, -1.0, 1
    @initRotation = 21.05, -1.0, 0, 0
    @attachRules = 1,1,0,0,1
}
@PART[landingLeg1-2]
{
    node_stack_top = 0.0, 0.4271562, 0.05, 0.0, 1.0, -0.33, 1
    @initRotation = 36.5, -1.0, 0, 0
    @attachRules = 1,1,0,0,1
}

 

Original initRotation values

landingLeg1

     initRotation = 92.098920000, -0.1879652,-0.9640219,-0.1879652

 

landingLeg2

     initRotation = 95.187980000, -0.2879681,-0.9133175,-0.287968

 

Also the node itself seems to be rotated.

2fascreenshot2.png

 

However, it does basically work if I nix out the initRotate and use different node settings, like in these patches.  The leg just doesn't look lined up when it's not attached, and the LT-2 has trouble attaching, by rapidly switching between on the node and hovering/red.

@PART[landingLeg1]
{
    node_stack_top = 0.0, 0.0, 0.0, 0.0, 0.4, -1.0, 1
    @initRotation = 0,0,0,0
    @attachRules = 1,1,0,0,1
}
@PART[landingLeg1-2]
{
    node_stack_top = 0.0, 0.4271562, 0.05, 0.0, 0.7, -1.0, 1
    @initRotation = 0,0,0,0
    @attachRules = 1,1,0,0,1
}

3e4screenshot31.png

23escreenshot30.png

 

I have a feeling I'm using one of these parameters incorrectly.  I would appreciate any direction.

 

Edited by Geonovast

Share this post


Link to post
Share on other sites

I think I know what the problem is but I’m not sure I can explain it. Here goes:

The legs were probably made with the piston vertical. The attachment point was then added later at an angle. 

To get it to the ‘proper’ look they had to rotate the model so the angled attachment point looks straight. In other words, all offset is relative to the piston, not the attachment plate. 

Maybe ive missed it, but what happens when you use the default rotation values?

edit: and what happens when you use a side node instead of a top node? Maybe it’s just the top node not rotating along nicely with different rotation placements. 

Edit 2: it does look like the node isn’t rotating with the part.. was this when you used symmetry?

Edited by Jognt

Share this post


Link to post
Share on other sites
1 hour ago, Jognt said:

The legs were probably made with the piston vertical. The attachment point was then added later at an angle. 

Which makes sense.  However, the things seem to be rotated on all three axis, instead of just one to compensate for that.

1 hour ago, Jognt said:

Maybe ive missed it, but what happens when you use the default rotation values?

The part will try to attach at some obscure angle in all three directions.

1 hour ago, Jognt said:

edit: and what happens when you use a side node instead of a top node? Maybe it’s just the top node not rotating along nicely with different rotation placements. 

You mean in node_attach_top?  It's just a name, the game ignores everything after the second underscore, I could name it node_attach_kerflipisklop and it wouldn't make a difference.

1 hour ago, Jognt said:

Edit 2: it does look like the node isn’t rotating with the part.. was this when you used symmetry?

No, all individually place. 

Share this post


Link to post
Share on other sites

Looking at initRotation in C# assemblies, it's a quaternion, not Euclidean angles (that also means that a "no rotation" value would be 0, 0, 0, 1 ).  I suspect you need to convert your angles to a quaternion, and use that, instead.  (Wikipedia has the equations, and there may be online converters, too)

Share this post


Link to post
Share on other sites

@MOARdV

I have no idea what that means, but I aim to find out.  Thanks for the reference.

Share this post


Link to post
Share on other sites

@Geonovast Hmm.. Again, I'll recommend using NodeHelper... You can actively and visually watch the nodes rotate and re-orient, right in the editor... It also has a pointer to indicate which direction the attach nodes are set for... It allows you to live-change the node coords, rotations, and sizes...

As to quaternion conversion, you could also install Blender 3D modelling program, and use Taniwha's Blender Mu Import-Export Tool... The process to get quaternions displayed as proper x/y/z angles would only be a few clicks long.
 

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Geonovast said:

I have no idea what that means, but I aim to find out.

Quaternions are one of those evil things mathematicians came up with to make math more complicated.  And then graphics programmers realized they could use them to make programming more complicated, too. :)  (actually, there are legitimate reasons for their use in graphics, but that's a whole different dissertation)

I could put together an Excel spreadsheet that can convert rotations to quaternions, but it'll be a couple of days before I can sit down and dust off Excel and write it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now