Skip to content

Force should not be applied and then reduce manually #291

@Segelzwerg

Description

@Segelzwerg

velocity *= speed;
velocity.y = 0;
_rigidbody.AddForce(velocity, ForceMode.Impulse);
// make sure, that the player is not able to be faster then the momentarily speed level is allowing him to be
velocity = _rigidbody.velocity;
velocity.y = 0;
velocity = velocity.normalized * Mathf.Clamp(velocity.magnitude, 0, speed);
velocity.y = _rigidbody.velocity.y;
_rigidbody.velocity = velocity;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions