map-pin Rotating Objects Around More Than One Axis

  • Buzzmusic
  • Buzzmusic's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • I make levels and songs.
  • Posts: 678
  • Thank you received: 145
10 Aug 2011 01:49 #1
I would like to rotate an object 6 degrees on the X axis and 45 degrees on the Z. I only see how to set one axis at a time. Is there a way to do both?

All posts from my account that were made before July 29 2013 are from the point of view of my dad unless it states otherwise.

Please Log in or Create an account to join the conversation.

  • Perishingflames
  • Perishingflames's Avatar
  • Offline
  • Senior Marbler
  • Senior Marbler
  • Posts: 882
  • Thank you received: 21
10 Aug 2011 03:26 #2
If you're on a pc, rotate the first axis using the rotation field, then alt-click and drag the other axis. Know that this will product buggy interiors (in that the marble can easily get stuck in them) though.

A while back there was some discussion about the way the rotation field works here and here but nothing that's going to help. I thought I remembered technostick figuring it out but can't find the thread.

Please Log in or Create an account to join the conversation.

  • Posts: 521
  • Thank you received: 2
10 Aug 2011 20:51 #3
He's on a Mac, so from what I've heard and from my own experience, manually rotating objects is impossible. (within the level editor)

Also, Riblet, if you enter .5 .5 0 90, the game WILL rotate the object by (close to) 45 degrees in both the X and Y direction. However, it will also reassign the numbers (√2)/2 (√2)/2 0 60. I have NO idea why. And if you multiply (√2)/2 by 60, you get 42 something.

Please Log in or Create an account to join the conversation.

  • Posts: 521
  • Thank you received: 2
10 Aug 2011 21:05 #4
Aug 10, 2011, 2:03pm, riblet15 wrote:Yeah, that's what I had noticed. Someone should go through every single one of Technostick's posts and try to find the real explanation

I'm looking atm actually. But the search function is being buggy right now. I asked it to look posts containing rotation made by technostick, but instead it's returning only posts made by technostick and ignoring the rotation.

Please Log in or Create an account to join the conversation.

  • Perishingflames
  • Perishingflames's Avatar
  • Offline
  • Senior Marbler
  • Senior Marbler
  • Posts: 882
  • Thank you received: 21
10 Aug 2011 21:19 #5
Use google, site:marbleblast.com to search this site.


Aug 10, 2011, 1:51pm, sporlo wrote:However, it will also reassign the numbers (√2)/2 (√2)/2 0 60. I have NO idea why. And if you multiply (√2)/2 by 60, you get 42 something.

Like that person posted before, that looks just like sin(theta) cos(theta) 0 but likewise I have no idea what the 60 is for.

And the 0.5 0 1 90 example doesn't hold up for 1 0 1 90 to rotate it 90 degrees on the x and z. I think that's just coincidence not the rule.

Please Log in or Create an account to join the conversation.

  • Posts: 121
  • Thank you received: 0
10 Aug 2011 21:24 #6
I've also noticed that if you type in a value like .25 .5 0 90 the interior becomes just as problematic as using the alt-rotate method (which I don't think works on mac?)

I would love to know the real explanation...

Please Log in or Create an account to join the conversation.

  • Posts: 521
  • Thank you received: 2
10 Aug 2011 21:26 #7
Aug 10, 2011, 2:19pm, perishingflames wrote:Use google, site:marbleblast.com to search this site. Genius. (so simple I didn't think of it)

Anyhow, I managed to find the old threads:
www.garagegames.com/community/forums/viewthread/40000
And this MBF thread I myself actually started with a question very similar to ajdallas.
marbleblast.com/index.cgi?board=lbrb&action=display&thread=1715


Aug 10, 2011, 2:24pm, riblet15 wrote:I've also noticed that if you type in a value like .25 .5 0 90 the interior becomes just as problematic as using the alt-rotate method (which I don't think works on mac?)

I would love to know the real explanation...

Correct: doesn't work on a Mac. Also, I too noticed that even typing in something like .5 .5 0 90 caused the interior to bug out.


technostick starts talking about quarternions. So I randomly Googled it and here you go: (not that I think this will be helpful, but it's something to read if you get bored)
en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
The following user(s) said Thank You: Evokrypt

Please Log in or Create an account to join the conversation.

  • Posts: 121
  • Thank you received: 0
10 Aug 2011 21:44 #8
So yeah, all these discoveries were already made 5 years ago. Doesn't look like anyone ever came up with a real clarification though...and glancing at that wikipedia article looks like I won't be one to help write it up

Please Log in or Create an account to join the conversation.

  • Posts: 521
  • Thank you received: 2
10 Aug 2011 21:47 #9
lol scratch that 5 years ago and put 13 years ago

This article is from 1998!!!
Once again I haven't read through this thing, but it contains similar language about rotation.
www.gamasutra.com/view/feature/32....quaternions.php

www.gpwiki.org/index.php/OpenGL:T....resent_rotation

(just posting random articles when you Google rotating objects using quarternions)

(I feel like an idiot reading these articles )
www.cprogramming.com/tutorial/3d/quaternions.html

Another one:
www.wag.caltech.edu/home/meulbroek/Quate...xtentions/index.html

Edit: fixed the links. ~Aayrl

Please Log in or Create an account to join the conversation.

  • Buzzmusic
  • Buzzmusic's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • I make levels and songs.
  • Posts: 678
  • Thank you received: 145
10 Aug 2011 23:49 #10
We looked at the GarageGames thread that Sporlo posted. It made things much clearer.

0.14 0 1 45 :

X = (0.14 x 45) = 6.3 deg
Y = (0 x 45) = 0
Z = (1 x 45) = 45 deg

So, this is close enough, since we wanted X=6, Y=0, Z=45.
Buzzmusic100 will try this out and post back the results.

Thanks so much for the help and links!

All posts from my account that were made before July 29 2013 are from the point of view of my dad unless it states otherwise.

Please Log in or Create an account to join the conversation.

  • HiGuy
  • HiGuy's Avatar
  • Offline
  • Lead Developer
  • Lead Developer
  • PQ Developer Emeritus
  • Posts: 1334
  • Thank you received: 605
11 Aug 2011 04:25 #11
Um, unknown possible solution, but try this:

Desired:
6 0 45

So we add
6 + 45 = 51

And we divide
6/51 = 2/17 = 0.11764705...
45/51 = 15/17 = 0.88235294...


So we fill in:
0.11764705 0 0.88235294 51

That is how I think it works, but I'm not certain.

HiGuy

EDIT: Just tried it, looks pretty much like 6 x 45 z. Can't be quite sure. Also, it changed the rotation values to this:
0.132164 0 0.991228 45.0671

Hmm...

EDIT EDIT: Fixed a few things. Also noticed you solved it Oh well. I wonder if this ( ^ ^ ^ ) is how it actually works...

This signature is real code
Code:
function clientcmd12dothepq() { commandToClient(LocalClientConnection, '34onthedancefloor'); }

Please Log in or Create an account to join the conversation.

  • Seizure22
  • Seizure22's Avatar
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • Posts: 79
  • Thank you received: 0
13 Aug 2011 04:10 #12
the problem here is that we all gravitate towards quaternions when it actually uses axis angles, a similar four-unit way to represent rotation

this is the code you want:
Code://Axis Angle to Euler (Pitch Yaw Roll); Credit: Matthew Jessick and Brendan Fletcher @ GG Community

function rotAAtoE(%axisAngle)
{
%angleOver2 = -getWord(%axisAngle,3)/2;
%sinThetaOver2 = mSin(%angleOver2);

%q0 = mCos(%angleOver2);
%q1 = getWord(%axisAngle,0) * %sinThetaOver2;
%q2 = getWord(%axisAngle,1) * %sinThetaOver2;
%q3 = getWord(%axisAngle,2) * %sinThetaOver2;
%q4 = %q0*%q0;

return vectorScale(mAsin(2*(%q2*%q3 + %q0*%q1))
SPC mAtan(%q0*%q2 - %q1*%q3, (%q4+%q3*%q3)-0.5)
SPC mAtan(%q0*%q3 - %q1*%q2, (%q4+%q2*%q2)-0.5) ,-180/$pi);
}

//Credit: Eric Hartman @ GG Community (function originally called eulerToQuat)

function rotEtoAA(%euler, %rotflag)
{
%euler2 = VectorScale(%euler, $pi / 180); //convert euler rotations to radians

%matrix = MatrixCreateFromEuler(%euler2); //make a rotation matrix
%xvec = getWord(%matrix, 3); //get the parts of the matrix you need
%yvec = getWord(%matrix, 4);
%zvec = getWord(%matrix, 5);
%ang = getWord(%matrix, 6); //this is in radians
if (!%rotflag)
%ang = %ang * (180 / $pi); //convert back to degrees

%rotationMatrix = %xvec SPC %yvec SPC %zvec SPC %ang; //put it all together

return %rotationMatrix; //send it back
}

setting %rotflag to true will return the last unit in degrees.

generally, you should not use degrees other than

- when inputting a value in the editor
- when creating a new game object from script
- when editing a mission directly

all other uses (including setTransform, getTransform, and our RotAAtoE function above) will use radians for the last unit.


now, to [attempt to] solve OP's problem:

%object.setTransform(%object.getPosition() SPC rotEtoAA(6 0 45));

this may not solve your problem if the game applies rotations to axes in a different order than you expect.

Please Log in or Create an account to join the conversation.

  • Posts: 121
  • Thank you received: 0
13 Aug 2011 06:36 #13
Whoa, that explains a lot. Thank you so much, Seizure. I have no idea what to do with your code there, but

To answer OP's original question, I believe the numbers you would input into the rotation box would be

.125 -.051 .99 45.37

I hope I didn't mix around the numbers. I don't really know what I'm doing but here's a simple guide if you're like me and have no idea what to do with Seizure's stuff:


Use the java calculator at
www.euclideanspace.com/maths/geom....ogram/index.htm

input the angles of rotation you want, make sure both settings are in degrees

heading = z
attitude = y
bank = x

you get some numbers at the bottom right, you'll want to put these into marbleblast in the order

X Z Y Angle

this at least works for me, there's probably a way that's heaps better than this but at least we understand what's going on now. If someone can make this easier please do

Please Log in or Create an account to join the conversation.

  • Posts: 1949
  • Thank you received: 18
13 Aug 2011 09:03 #14
Glad this finally got solved. Thanks, Seizure! Stickied.

Please Log in or Create an account to join the conversation.

Moderators: Doomblah
Time to create page: 1.530 seconds
We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.