Jump to content

How do ships fly?


Two

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...