Page 1 of 1

Rotating Subentities

Posted: Sun Feb 25, 2007 11:41 am
by Killer Wolf
hi again.

getting complex in my building now - i'm doing a spacestation. prob i think i'm going to run into is rotating a couple of its subents. i've done my docking slit, aligned the middle of it at 0-0-0, and due to the shape of the model in full, this means that the spinning parts are not aligned over any of the axes.
so, can anyone explain this to me please (entry from wiki) :
Rotational Velocity

May be applied to a sub-entity, like the following entry to the subentity spines of the Weeviloid Hunter. Takes the form of quaternions. The following example enables rotation around the Z-axis.

Example:

<key>rotational_velocity</key>
<string>0.707 0.0 0.0 0.707</string>
what do the numbers mean? i'm guessing one is the actual speed, the rest some reference point? i want counter-rotating bits, so hopefully negativising (?!) the speed would give it an anticlockwise spin :-/

cheers in advance

Posted: Sun Feb 25, 2007 12:01 pm
by Charlie
The numbers mean little to be but by much trial & error I've reached the point where I can rotate my sub-entities at whatever speed & direction I want. ( Also the plane of rotation can be adjusted - but harder to explain )

I would suggest looking @ the insides of: Condor.oxp & Orb.oxp - they shoud give some ideas on how to adjust speed + rotation :)
Pallas.oxp will hopefully give some pointers on changing the plane of rotation too. ( Watch out I made an error with that one - you don't have to redo your s-e.dat file as I did... )

May also be worth looking @ https://bb.oolite.space/viewtopic.php?t=2886
for some specifics

Posted: Sun Feb 25, 2007 12:51 pm
by Killer Wolf
oh gods, i got a headache just skimming that X-(

can't i just align the rotation point on the axes and have the Doc slot at like Z+500 or whatever? :-/

cheers charlie, i'll hunt out the other OXPs see if anything practical make more sense than theory!
(rotation...in an Orb...how can you tell?! :-D )

Posted: Sun Feb 25, 2007 2:17 pm
by Griff
Randall posted a great link to a website that worked out quaternons for you, the thread isn't around anymore but you can find the website here:-

http://www.euclideanspace.com:80/maths/ ... /index.htm

Posted: Mon Feb 26, 2007 7:38 am
by Killer Wolf
Cheers for those links guys....good lord, maths :-(

thing is, all this stuff (not that i've looked FULLY in depth yet) is all about rotations about axes. like i said, due to the design, i've had to shift everything back to get the dock entrance aligned w/ the origin at 0-0-0, so the only way i think i can get around this is to see if the dock stuff *has* to be originised. i was hoping the dock slot's attributes/AI can be tweaked, but i guess that's today's dinnertime research!

Posted: Mon Feb 26, 2007 1:56 pm
by Arexack_Heretic
I don't think the dock coordinates need be 0/0/0.
Only the dock-subentity model openended front needs to be 0/0/0.

You can place that entity anywhere on your main-model you like IIRC.

Posted: Mon Feb 26, 2007 2:37 pm
by Killer Wolf
:-/
sorry, didn't quite follow that bud. doesn't the fact that "Only the dock-subentity model openended front needs to be 0/0/0" determine that the dock-box entity *is* there, extending back?

however, i've been trawling threads and came across Judebert mentioning his dock-slits at either side of an Anaconda (couldn't find it on Oosat to disect tho, tch) and Giles said "Docking slits should be capable of being positioned anywhere, at any orientation. There may still be problems with the current collision detection code though..." so i'm just gonna try it and see what comes of it. seems from other things (someone point out my quaint ignorance if i'm wrong) that the whole thing is governed simple by a hollow entity w/ a "docking-slit" AI, which i assume decides when to trigger if your position = whateveritis, so making the box the right size and depth (250 seems to be relevant) should do it.

Posted: Mon Feb 26, 2007 3:07 pm
by Arexack_Heretic
yeah.

You can have a docking box open on all sides, I made it work in one of my dumped projects.
The entity is then just giving the game information o whether the ship is inside the box or still outside. (Collision detection)
the subentity 'dockingbox can be positioned in any orientation you like via the quaternion system.

Be aware, however that it is advisable to create a hole in the main model as well to prevent unpredictable collisions.
A hole of -10Z at the front is easier than a hole at 33degrees rotated around X and 45degrees around Y.

Problems also arise when turrets are introduced at close proximity to the dock or other subentities, I must warn you.

Posted: Mon Feb 26, 2007 7:18 pm
by Killer Wolf
i just need an open front. this "material = _hole_ thing : i'm just not putting a face there :-)

like i said, i'll just have to mess about and see what happens :-\

this quaternion thing....lordy, the only thing spinning so far is my head :-(
it seems so hard to follow : text says it's four values (hence the name!) but for positioning subents (i'll need to, the station has 5 parts) wiki has an example of
<string>weeviloid2-spine 0 0 0 1 0 0 0</string>
<string>weeviloid2-spine 0 0 0 0.5 0 0 0.8660254</string>
so....what are the other three values? :-/
there's a fair bit on what they do and how they calculate, but what about the spin speed? the ROTATIONAL_VELOCITY wotsit has
<key>rotational_velocity</key>
<string>0.707 0.0 0.0 0.707</string>
but the only definitions of quarts say angle, x,y,z - nowt about speed, so i'm assuming you just have to work out a bigger angle increment for a faster spin - might make the spin look jerky tho??

Posted: Mon Feb 26, 2007 7:57 pm
by Arexack_Heretic
you should read the earlier treatises on quaternions.

the subentity quaternion consists of:

objectname x y z qW qX qY qZ

the first three numbers are the relative position of the subentity compared to the main-entity's origin (0/0/0) in practice any point really, but quartenions refer to the origin.

The last four are the rotation quaternion. How they are calculated has been related multiple times http://wiki.alioth.net/index.php/Quaternions, I am not going to repeat all that here.
In short they decribe which axis through the origin the subentity is rotated about and by what angle.

Advanced:
quaternions can be cumulative by calculation (45degX+90degZ) for a SE-Zface pointing diagonally up to one side of the Main entity Z-axis.