I was looking for a way to quickly calculate quaternions for singular and 2 stage rotations.
Taking a look on the website I boiled down and weaponized the equations into a spread sheet. It's a little specialized I know but it saves dicking around for half an hour with a calculator.
www.crimsonforge.co.uk/cloister/Quaternion.xls
Quaternions
Moderators: winston, another_commander, Getafix
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Quaternions
You could look in BuoyRepair.oxp. In the script buoyRepair.js in the function this.addStation = function() I manipulate the station by rotating it in such a way that it orients to the planet as wel as to the main station.ClymAngus wrote:I was looking for a way to quickly calculate quaternions for singular and 2 stage rotations.
I hope you can use these examples
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- ClymAngus
- ---- E L I T E ----
- Posts: 2514
- Joined: Tue Jul 08, 2008 12:31 am
- Location: London England
- Contact:
Re: Quaternions
Cool. I wasn't thinking real time (I just need it to enhance some ship views so the spread sheets fine but, I'll take a look it's a very useful thing.Eric Walch wrote:You could look in BuoyRepair.oxp. In the script buoyRepair.js in the function this.addStation = function() I manipulate the station by rotating it in such a way that it orients to the planet as wel as to the main station.ClymAngus wrote:I was looking for a way to quickly calculate quaternions for singular and 2 stage rotations.
I hope you can use these examples
this might be of help for real time, it will orientate a ship toward the targetObject
Code: Select all
//for pre 1.73
this.aship.setOrientation(this.aship, this.orientationTo(targetObject))
//for after 1.73
this.aship.orientation(this.aship, this.orientationTo(targetObject))
this.orientationTo = function(centre, targetObject)
{
let vectorToTarget = targetObject.position.subtract(centre.position)
let forwardVector = centre.orientation.vectorForward()
let angle = forwardVector.angleTo(vectorToTarget)
let cross = forwardVector.cross(vectorToTarget).direction()
let q = this.rotateQ(centre.orientation, cross, -angle)
return q
}
Bounty Scanner
Number 935
Number 935