Package org.terasology.physics.engine

Examples of org.terasology.physics.engine.CharacterCollider


        } else {
            endVelocity.y = Math.max(-TERMINAL_VELOCITY, state.getVelocity().y - (GRAVITY * movementComp.mode.scaleGravity) * input.getDelta());
        }
        Vector3f moveDelta = new Vector3f(endVelocity);
        moveDelta.scale(input.getDelta());
        CharacterCollider collider = movementComp.mode.useCollision ? physics.getCharacterCollider(entity) : null;
        MoveResult moveResult = move(state.getPosition(), moveDelta,
                (state.getMode() != MovementMode.CLIMBING && state.isGrounded() && movementComp.mode.canBeGrounded) ? movementComp.stepHeight : 0,
                movementComp.slopeFactor, collider);
        Vector3f distanceMoved = new Vector3f(moveResult.getFinalPosition());
        distanceMoved.sub(state.getPosition());
View Full Code Here


        CharacterStateEvent.setToState(character, newState);
    }

    @ReceiveEvent(components = {CharacterMovementComponent.class, LocationComponent.class})
    public void onPlayerInput(CharacterMoveInputEvent input, EntityRef entity) {
        CharacterCollider characterCollider = physics.getCharacterCollider(entity);
        if (characterCollider.isPending()) {
            logger.debug("Skipping input, collision not yet established");
            return;
        }
        CircularBuffer<CharacterStateEvent> stateBuffer = characterStates.get(entity);
        CharacterStateEvent lastState = stateBuffer.getLast();
View Full Code Here

        }
    }

    @Override
    public CharacterCollider getCharacterCollider(EntityRef entity) {
        CharacterCollider cc = entityColliders.get(entity);
        if (cc == null) {
            cc = createCharacterCollider(entity);
        }
        return cc;
    }
View Full Code Here

     * @param entity The entity to set the location of.
     * @param newPos The new position of the entity.
     */
    private static void setPhysicsLocation(EntityRef entity, Vector3f newPos) {
        PhysicsEngine physics = CoreRegistry.get(PhysicsEngine.class);
        CharacterCollider collider = physics.getCharacterCollider(entity);
        collider.setLocation(newPos);
    }
View Full Code Here

TOP

Related Classes of org.terasology.physics.engine.CharacterCollider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.