#Spaceship Docking Code Issue

1 messages · Page 1 of 1 (latest)

elfin wharf
#

i have this f*** problem for 2 YEARS now and i cant fix it alone because i am dumb

context: this code spawn a hologram of ship1 to display where the ship would dock on ship2. it finds the closest docking point (closestPointInventory because the docking points are stored in the inventory interface, don't ask)

the simple issue is, on a certain rotation of the ship (90 degrees to be exact) and the dot being between 0.05 and -0.05, the alignment changes to the wrong one making the hologram ("spawnedd") ending up inside the ship2 as on the pic

i feel like an idiot because this looks so simple to solve but i tried EVERYTHING
just try to replicate it if you try to help

quick needle
#

Maybe provide the code responsible for positioning that hologram. !code
Refer to the bot message. Too much text uploads it as a file, whic his impossible to see on mobile without downloading the file.

stable copperBOT
elfin wharf
mental wyvern
#

try this :

#

Vector3 bestAlignment = (Mathf.Abs(Vector3.Dot(spawnForward, otherForward)) < 0.05f) ? otherForward : (Vector3.Dot(spawnForward, otherForward) > 0 ? otherForward : -otherForward);

#

you can bump it up as well

elfin wharf
#

i really tried EVERYTHING xD

mental wyvern
elfin wharf
mystic steppe
#

you should have already simplified the code down to 2 cubes to eliminate any issues with the data you're getting back from whatever Inventory is and to make it easier for others to help you