untoldwind / KontrolSystem2

Autopilot scripting system for KSP2
Other
54 stars 15 forks source link

steering manager oddity #81

Closed ColJay closed 1 year ago

ColJay commented 1 year ago

Something odd is afoot if i try something like this:

DEBUG.add_vector(fn() -> vessel.global_position, fn() -> vessel.global_up * 50, GREEN,"UP" , 1)

const control = control_steering(vessel) control.set_global_direction(vessel.global_up.to_direction) // change the desired rotation sleep(5)

The DEBUG vector points exactly where i'm expecting, the craft however appears to want to be horizontal to the ground, and then all over the place, not vertical. I seem to have some luck with other directions, so i wonder if i'm doing something wrong

untoldwind commented 1 year ago

Workaround in the meantime:

control.set_heading(0, 90, 0)

seems to work.

untoldwind commented 1 year ago

Problem is indeed the .to_direction() method which was doing a Quaternion.LookRotation(v, up). Turns out: Quaternion.LookRotation(up, up) creates something broken.

untoldwind commented 1 year ago

This should work now in 0.3.5 or 0.4.0.1

untoldwind commented 1 year ago

Closing this for now.