Two Posted March 1, 2017 Share Posted March 1, 2017 I was just looking into the code to probably find a solution for ships constantly destroying docking ports, where I stumbled over this line of code: local dock = station.position:transformCoord(pos + dir * ship:getBoundingBox().size.z * 0.5) Now I am slightly puzzled about how ships do fly internally. This line calculates the stopping position for the ship by the Z-size of the bounding box, but I would imagine that ships move "forward" towards their X-axis (that's at least how the player ship works), so it should be the X-size of the bounding box, right? Is this a bug in the Avorion code or am I not getting this right? Link to comment Share on other sites More sharing options...
Nathaniel Thorn Posted March 2, 2017 Share Posted March 2, 2017 X is not the front :) X = Right Y = Up Z = Look (front) However AFAIK it is not a given, that ships center position is in it's bounding box center, so for some ships this position would be too close to the station. To calculate that properly, the frontmost block should be found and use it's position & size as a distance instead of half of the ship along it's forward axis. Link to comment Share on other sites More sharing options...
Two Posted March 3, 2017 Author Share Posted March 3, 2017 Ok so we fly towards Z... good to know. ^^ And that bounding-box issue could explain why NPCs constantly try to destroy my stations. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now