mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
null check on body
This commit is contained in:
parent
492aed3259
commit
d30ed12ea8
@ -39,8 +39,9 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
|
|
||||||
private void UpdateTargetPositions()
|
private void UpdateTargetPositions()
|
||||||
{
|
{
|
||||||
var toPrimary = (_body.transform.position - _dustTargetBody.transform.position).normalized;
|
// body is null for proxies
|
||||||
var velocityDirection = (_primaryBody?.GetVelocity() ?? Vector3.zero) -_body.GetVelocity(); // Accept that this is flipped ok
|
var toPrimary = ((_body ? _body.transform : transform).position - _dustTargetBody.transform.position).normalized;
|
||||||
|
var velocityDirection = (_primaryBody?.GetVelocity() ?? Vector3.zero) - (_body ? _body.GetVelocity() : Vector3.zero); // Accept that this is flipped ok
|
||||||
|
|
||||||
var tangentVel = Vector3.ProjectOnPlane(velocityDirection, toPrimary) / velocityDirection.magnitude;
|
var tangentVel = Vector3.ProjectOnPlane(velocityDirection, toPrimary) / velocityDirection.magnitude;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user