Hi people! I've searched on mapster and through the internet and I've not found a complete answer to one little thing. I am trying to do a dialog with slidebars that changes the pitch and roll. Since it also uses the Yaw which is pretty much the same thing as unit facing, I set all 3.
I'm not the best in sin/cos things, and that's why I'm asking some help. I've got here through exploring map examples and online codes.
I have this action where Z, Pitch and Roll are simply 3 variables set with the dialog slider from 0-360:
Actor - Send actor message (SetRotation ((Cos(Z)) * (Cos(Pitch))) ((Sin(Z)) * (Cos(Pitch))) (Sin(Pitch)) ((Cos(Z)) * (Asin(Pitch))) ((Sin(Z)) * (Asin(Pitch))) (Cos(Pitch))) to main actor of unit unit
With that action I can change the Yaw and Pitch. I'm trying to find where to add the Roll in there. Most likely where there is no multiplications. But I don't know what it should be sin cos arcsine arccos...
When its set like this: Actor - Send actor message (SetRotation (Cos(Pitch)) (Sin(Pitch)) 0.0 (Sin(Roll)) 0.0 (Cos(Roll))) to main actor of unit unit
The pitch and yaw does not work, but it can roll correctly. So I believe all 3 rotations are possible.
Thanks if someone figure this out.
I'm trying to make a Dynamic Terrain Editor where you place actors on a terrain and you can save all their position and stuff so you can load them whenever you want via a long string. One of the things that remain for that DTE is Pitch and Roll. Once I figure how to send the message, i can then add it to the dte correctly and save/load the values of the pitch and roll.
Note: The few triggers are a bit messy but it works, just focus on the actor message.
I assume by "Z" you mean "Yaw"? Strange name for it...
Anyway will see what I can do.
EDIT: Here is the solution. It was hacked together from various OpenGL support sites. To compute it you need to multiply together 3 rotation matrices in the appropriate order. Fortunately this is a pretty common sort of conversion with regards to computer graphics programming so there are tons of ready-made product matrices to take the result from online (once you translate axis you are pretty much good to go and implement it). Otherwise I would advise pushing it through Wolfram Alpha as that will likely compute the optimal solution for the matrix multiplication far easier than you having to run through all the possible simplifications yourself.
Fortunately only two vectors are required (X and Z) so you can discard an entire column of the rotation matrix.
To speed up the result, caching of sin and cos values is used as they are reasonably expensive to compute. Some expression arguments are used to make up for GUI lacking a negating operation (and subtracting from 0 is stupid), Expressions are Galaxy statements which undergo GUI substitution for certain named sequences giving you the power of Galaxy mathematics and operators while still using GUI generated expressions.
I read all your comment just like if i was understanding everything, and at the end i was like, wtf did i just read? Like, it woks, huge thanks, but i have no idea how/why. I just don't have the matrice knowledge or any computer graphics programming skill.
This is epic. Big big big big thanks.
Edit: here is a screen showing it in the DTE. Looks awesome :D
Hi people! I've searched on mapster and through the internet and I've not found a complete answer to one little thing. I am trying to do a dialog with slidebars that changes the pitch and roll. Since it also uses the Yaw which is pretty much the same thing as unit facing, I set all 3.
I'm not the best in sin/cos things, and that's why I'm asking some help. I've got here through exploring map examples and online codes.
I have this action where Z, Pitch and Roll are simply 3 variables set with the dialog slider from 0-360:
Actor - Send actor message (SetRotation ((Cos(Z)) * (Cos(Pitch))) ((Sin(Z)) * (Cos(Pitch))) (Sin(Pitch)) ((Cos(Z)) * (Asin(Pitch))) ((Sin(Z)) * (Asin(Pitch))) (Cos(Pitch))) to main actor of unit unit
With that action I can change the Yaw and Pitch. I'm trying to find where to add the Roll in there. Most likely where there is no multiplications. But I don't know what it should be sin cos arcsine arccos...
When its set like this: Actor - Send actor message (SetRotation (Cos(Pitch)) (Sin(Pitch)) 0.0 (Sin(Roll)) 0.0 (Cos(Roll))) to main actor of unit unit
The pitch and yaw does not work, but it can roll correctly. So I believe all 3 rotations are possible.
Thanks if someone figure this out.
I'm trying to make a Dynamic Terrain Editor where you place actors on a terrain and you can save all their position and stuff so you can load them whenever you want via a long string. One of the things that remain for that DTE is Pitch and Roll. Once I figure how to send the message, i can then add it to the dte correctly and save/load the values of the pitch and roll.
Note: The few triggers are a bit messy but it works, just focus on the actor message.
Working on projects:
I assume by "Z" you mean "Yaw"? Strange name for it...
Anyway will see what I can do.
EDIT: Here is the solution. It was hacked together from various OpenGL support sites. To compute it you need to multiply together 3 rotation matrices in the appropriate order. Fortunately this is a pretty common sort of conversion with regards to computer graphics programming so there are tons of ready-made product matrices to take the result from online (once you translate axis you are pretty much good to go and implement it). Otherwise I would advise pushing it through Wolfram Alpha as that will likely compute the optimal solution for the matrix multiplication far easier than you having to run through all the possible simplifications yourself.
Fortunately only two vectors are required (X and Z) so you can discard an entire column of the rotation matrix.
To speed up the result, caching of sin and cos values is used as they are reasonably expensive to compute. Some expression arguments are used to make up for GUI lacking a negating operation (and subtracting from 0 is stupid), Expressions are Galaxy statements which undergo GUI substitution for certain named sequences giving you the power of Galaxy mathematics and operators while still using GUI generated expressions.
@ImperialGood: Go
I read all your comment just like if i was understanding everything, and at the end i was like, wtf did i just read? Like, it woks, huge thanks, but i have no idea how/why. I just don't have the matrice knowledge or any computer graphics programming skill.
This is epic. Big big big big thanks.
Edit: here is a screen showing it in the DTE. Looks awesome :D
Working on projects: