Skip to content

Commit

Permalink
Adjusted pilus position for prokaryotes (#4631)
Browse files Browse the repository at this point in the history
so that it is no longer too long or too short in certain situations. Still probably some tweaking / root problem analysis left to do.
  • Loading branch information
hhyyrylainen authored Dec 8, 2023
1 parent dc2871b commit 103ace7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/microbe_stage/PlacedOrganelle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,15 @@ public Transform CalculateVisualsTransformExternalCached()
var extraRotation = new Quat(new Vector3(1, 0, 0), Mathf.Pi * 0.5f);

// Maybe should have a variable for physics shape offset if different organelles need different things
var offset = new Vector3(0, 0, isBacteria ? 1.0f : -1.0f);
var offset = new Vector3(0, 0, -1.0f);

// TODO: figure out why the pilus positioning ends up really strange for bacteria and needs adjustment when
// bigger
// Need to adjust physics position for bacteria scale
if (isBacteria)
{
var length = externalPosition.Length();
if (length > 4)
offset.z += length * Constants.BACTERIA_PILUS_ATTACH_ADJUSTMENT;
// TODO: find the root cause and fix properly why this kind of very specific tweak is needed
var length = externalPosition.Length() * 0.575f;

offset.z += length;
}

return (externalPosition + orientation.Xform(offset), orientation * extraRotation);
Expand Down

0 comments on commit 103ace7

Please sign in to comment.