Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE PARAMETER steerVector.
- set directionVector to VXCL(ship:facing:foreVector, steerVector).
- if VANG(ship:facing:starVector, directionVector) > 90 {
- set vectorAngle to VANG(ship:facing:topVector,directionVector).
- }
- else { set vectorAngle to 360-VANG(ship:facing:topVector,directionVector). }.
- set facingAngle to VANG(ship:facing:foreVector, steerVector).
- set pitchAngle to cos(vectorAngle)*facingAngle.
- set yawAngle to sin(vectorAngle)*facingAngle.
- set pitchE0 to pitchAngle.
- set yawE0 to yawAngle.
- set rollE0 to ship:facing:roll.
- set t0 to time:seconds.
- WAIT 0.05.
- set directionVector to VXCL(ship:facing:foreVector, steerVector).
- if VANG(ship:facing:starVector, directionVector) > 90 {
- set vectorAngle to VANG(ship:facing:topVector,directionVector).
- }
- else { set vectorAngle to 360-VANG(ship:facing:topVector,directionVector). }.
- set facingAngle to VANG(ship:facing:foreVector, steerVector).
- set pitchAngle to cos(vectorAngle)*facingAngle.
- set yawAngle to sin(vectorAngle)*facingAngle.
- set t1 to time:seconds.
- set pitchE1 to pitchAngle.
- set yawE1 to yawAngle.
- set rollE1 to ship:facing:roll.
- set dPitch to (pitchE1 - pitchE0)/(t1 - t0).
- set dYaw to (yawE1 - yawE0)/(t1 - t0).
- set dRoll to (rollE1 - rollE0)/(t1 - t0).
- set ship:control:pitch to (pitchP*pitchE1 + pitchD*dPitch).
- set ship:control:yaw to -1*(yawP*yawE1 + yawD*dYaw).
- set ship:control:roll to (rollD*dRoll).
Advertisement
Add Comment
Please, Sign In to add comment