So, I want to write target tracking program. I don't want the main command chip to be involved in tracking, so I need to use vectors. Having them in local coordinates would help a lot as the program wouldn't have to deal with craft's rotation. But... I've read some forums for Unity users etc, but in here it just works in some weird way. Could someone please help me to figure out how does it work?

Tags
Question

4 Comments

  • Log in to leave a comment
  • Profile image
    6,682 JamesV4

    the unsolved mystery of bartreck

    2.0 years ago
  • Profile image
    644 Bartreck

    @sflanker What I'm trying to do is a program, which will get target's position relative to gun position. Also I hope it will consider target lead (for being able to hit moving target). This is why the command chip cannon be fixed to the gun and just be locked on target. Also if I would want to install in on a spacecraft the ship would be uncontrollable. This is why I need its position in local coordinates (in PCI I would have to get target's position, craft's rotation and then considering all of this, the direction). I tried to figure out how local works by calculating vector, just as you've written and transforming it to local. I somehow missed, that it was set to Local to PCI instead of PCI to Local. I was very confused, as when I was rotating my rover (I've made ground tests) coordinates changed, which was good. But they were also changing as the Earth was rotating, and that's why I thought, that Local works in some weird way. I realised that, when I checked the program again, and now everything is clear. Nonetheless thank you very much. Sorry for my english, I'm from Poland.

    3.9 years ago
  • Profile image
    Mod sflanker

    I'm a little fuzzy on what you are trying to do. However, if you just want to get the position of another craft relative to the current craft you can either use the nav [Target Position] if you are tracking the current target, or craft [id] [Position] if you are tracking an arbitrary craft. You can then take the difference between that vector and your nav [Position] vector. You can think of vectors as arrows, PCI position vectors are arrows pointing from the center of the current planet to the crafts. When you subtract position vector A from position vector B you get a vector (or arrow) that when it starts a craft A, points to craft B.

    The resultant PCI vector we will be with respect to a reference frame that remains fixed in relation to distance stars. If you want the vector oriented with respect to the current craft's orientation you can use the part [0] [PCI to Local] [vector relative to your craft] instruction. This "local" vector will be relative to a coordinate system where the Z axis is up and down the length of your craft (i.e. (0, 0, 1) points "up" from the nose of your craft), the Y axis is the yaw axis, and the X axis is the pitch axis. This would be useful if you are interested in where the tracked object is relative to the direction or craft is pointing.

    +1 3.9 years ago
  • Profile image
    43.2k goz

    Hi @Bartreck, it would be too difficult for me to try and explain here in words, but my pal @Sflanker has a knack for laying out difficult concepts like this.

    It may not be much help, but the final docking code in This Craft may spark some insights.

    +1 3.9 years ago

No Upvotes

Log in in to upvote this post.