src/main/java/li/cil/oc2/common/entity/RobotEntity.java
// init to "random" to avoid synchronous hovering
init to "random" to avoid synchronous hovering
init to " random " to avoid synchronous hovering
public void update(final float deltaTime, final Random random) {
            if (getState().isRunning() || actionProcessor.hasQueuedActions()) {
                topRenderHover = topRenderHover + deltaTime * HOVER_ANIMATION_SPEED;
                final float topOffsetY = MathHelper.sin(topRenderHover) / 32f;
                topRenderOffsetY = lerpClamped(topRenderOffsetY, topOffsetY, deltaTime * TRANSLATION_SPEED);
                baseRenderOffsetY = lerpClamped(baseRenderOffsetY, topOffsetY, deltaTime * TRANSLATION_SPEED);
                topRenderRotationY = lerpClamped(topRenderRotationY, topRenderTargetRotationY, deltaTime * topRenderRotationSpeed);
                if (topRenderRotationY == topRenderTargetRotationY) {
                    topRenderTargetRotationY = remapFrom01To(random.nextFloat(), -MAX_ROTATION, MAX_ROTATION);
                    topRenderRotationSpeed = remapFrom01To(random.nextFloat(), MIN_ROTATION_SPEED, MAX_ROTATION_SPEED);
                }
            } else {
                topRenderOffsetY = lerpClamped(topRenderOffsetY, TOP_IDLE_Y, deltaTime * TRANSLATION_SPEED * 2);
                baseRenderOffsetY = lerpClamped(baseRenderOffsetY, BASE_IDLE_Y, deltaTime * TRANSLATION_SPEED);
                topRenderRotationY = lerpClamped(topRenderRotationY, 0, deltaTime * ROTATION_SPEED);
            }
        }
public void update ( final float deltaTime , final Random random ) { if ( getState ( ) . isRunning ( ) || actionProcessor . hasQueuedActions ( ) ) { topRenderHover = topRenderHover + deltaTime * HOVER_ANIMATION_SPEED ; final float topOffsetY = MathHelper . sin ( topRenderHover ) / 32f ; topRenderOffsetY = lerpClamped ( topRenderOffsetY , topOffsetY , deltaTime * TRANSLATION_SPEED ) ; baseRenderOffsetY = lerpClamped ( baseRenderOffsetY , topOffsetY , deltaTime * TRANSLATION_SPEED ) ; topRenderRotationY = lerpClamped ( topRenderRotationY , topRenderTargetRotationY , deltaTime * topRenderRotationSpeed ) ; if ( topRenderRotationY == topRenderTargetRotationY ) { topRenderTargetRotationY = remapFrom01To ( random . nextFloat ( ) , - MAX_ROTATION , MAX_ROTATION ) ; topRenderRotationSpeed = remapFrom01To ( random . nextFloat ( ) , MIN_ROTATION_SPEED , MAX_ROTATION_SPEED ) ; } } else { topRenderOffsetY = lerpClamped ( topRenderOffsetY , TOP_IDLE_Y , deltaTime * TRANSLATION_SPEED * 2 ) ; baseRenderOffsetY = lerpClamped ( baseRenderOffsetY , BASE_IDLE_Y , deltaTime * TRANSLATION_SPEED ) ; topRenderRotationY = lerpClamped ( topRenderRotationY , 0 , deltaTime * ROTATION_SPEED ) ; } }
init to "random" to avoid synchronous hovering
init to " random " to avoid synchronous hovering