Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HurtboxComponent knockback/impact on hitting HitboxComponent #1

Open
AlecSouthward opened this issue Mar 6, 2024 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@AlecSouthward
Copy link
Owner

Code that can be reused:

var ray_parameters := PhysicsRayQueryParameters2D.create(area.global_position, global_position)
        var ray := get_world_2d().direct_space_state.intersect_ray(ray_parameters)
        
        if (!velocity_component):
            velocity_component.set_velocity((global_position - ray.position).normalized() * area.impact_power * 10)
@AlecSouthward AlecSouthward added the enhancement New feature or request label Mar 6, 2024
@AlecSouthward AlecSouthward self-assigned this Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant