Edit of asset "Ballistic Solutions (GDScript, C#)" Accepted
Old/Current | New/Edit | |
---|---|---|
Title | Ballistic Solutions (GDScript, C#) | |
Description |
Library for calculating interception times, impact positions, and firing vectors, taking into account the velocities and accelerations of both projectile and target. Example: # ... @export var projectile_packed_scene: PackedScene var projectile_speed: float = 200 var projectile_acceleration: Vector2 = Vector2.ZERO func shoot(target: Target2D) -> void: var to_target: Vector2 = target.global_position - global_position var velocity: Vector2 = Bsc.best_firing_velocity_vector2(projectile_speed, to_target, target.velocity, projectile_acceleration, target.acceleration) if is_nan(velocity.x): print("Impossible to hit the target") return var new_projectile: Projectile2D = projectile_packed_scene.instantiate() new_projectile.global_position = global_position new_projectile.velocity = velocity new_projectile.acceleration = projectile_acceleration get_parent().add_child(new_projectile) |
Ballistic deflection calculator is a tool for calculating the shot vector considering speeds and accelerations for Godot. Methods Array[float] times_to_hit_vector2(...) static Array[float] times_to_hit_vector3(...) static Array[float] times_to_hit_vector4(...) static Array[Vector2] velocities_vector2(...) static Array[Vector3] velocities_vector3(...) static Array[Vector4] velocities_vector4(...) static Vector2 velocity_from_time_to_hit_vector2(...) static Vector3 velocity_from_time_to_hit_vector3(...) static Vector4 velocity_from_time_to_hit_vector4(...) static Example const BULLET_SCENE: PackedScene = preload("res://.../bullet.tscn") var bullet_speed: float = 300 func shoot(target: CharacterBody2D) -> void: var to_target: Vector2 = target.global_position - global_position var bullet_velocities: Array[Vector2] = BDC.velocities_vector2(bullet_speed, to_target, target.velocity) if bullet_velocities.size() == 0: print("impossible to hit the target") return var bullet: CharacterBody2D = BULLET_SCENE.instantiate() bullet.global_position = global_position bullet.velocity = bullet_velocities[0] get_parent().add_child(bullet) |
Category | Scripts | |
License | MIT | |
Repository Provider | GitHub | |
Repository Url | https://github.com/neclor/ballistic-solutions | |
Issues Url | https://github.com/neclor/ballistic-solutions/issues | |
Godot version | Godot 4.0 | |
Version String | 4.0.1 | 2.1.1 |
Download Commit | 491ffeb7be4816d9d913a09fcc37a500c4390f76 | 8113da0864d935d1987a9fa437b72424f4b0be5b |
Download Url (Computed) | https://github.com/neclor/ballistic-solutions/archive/491ffeb7be4816d9d913a09fcc37a500c4390f76.zip | https://github.com/neclor/ballistic-solutions/archive/8113da0864d935d1987a9fa437b72424f4b0be5b.zip |
Icon Url |
https://raw.githubusercontent.com/neclor/ballistic-solutions/main/icon.png
![]() |
Preview Insert | ||
---|---|---|
Type | image | |
Image/Video URL |
https://raw.githubusercontent.com/neclor/ballistic-deflection-calculator-godot/main/docs/screenshot.png
![]() |
|
Thumbnail |
|