void Update() { rcController.UpdateRaycastOrigins(); Vector3 moveDistance = CalculatePlatformMovement(); CalculatePassengerMovement(moveDistance); MovePassengers(true); transform.Translate(moveDistance); MovePassengers(false); }
private void Update() { m_RaycastController.UpdateRaycastOrigins(); Vector3 velocity = CalculatePlatformMovement(); CalculatePassengerMovement(velocity); MovePassengers(true); transform.Translate(velocity); MovePassengers(false); }
// Update is called once per frame void Update() { rc.UpdateRaycastOrigins(); Vector3 velocity = CalculatePlatformMovement(); CalculatePassengerMovement(velocity); //move passenger before platform when platform moving down to prevent bouncing MovePassengers(true); transform.Translate(velocity); //move passenger after platform when platform is going up to avoid passenger clipping down MovePassengers(false); }
public void Move(Vector2 moveAmount, bool standingOnPlatform = false) { raycastController.UpdateRaycastOrigins(); collisions.Reset(); if (moveAmount.x != 0) { collisions.faceDir = (int)Mathf.Sign(moveAmount.x); } HorizontalCollisions(ref moveAmount); if (moveAmount.y != 0) { VerticalCollisions(ref moveAmount); } _tran.Translate(moveAmount); if (standingOnPlatform) { collisions.below = true; } }