Edit of asset "Ballistic Solutions (GDScript, C#)" Accepted
Old/Current | New/Edit | |
---|---|---|
Title | Ballistic Solutions (GDScript, C#) | Deflection (ballistics) Formula |
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) |
Function on GDScript for calculating the vector of an “intercepting” shot, considering “external” accelerations. Using Function take bullet speed, target position, target velocity and optional(target_acceleration, bullet_acceleration), and returns an vector of length bullet speed. If a hit is not possible, the function will return a zero vector. Warning Also used an addon for solving equations. (https://godotengine.org/asset-library/asset/2998) Functions in current version vector2(bullet_speed: float, target_position: Vector2, target_velocity: Vector2, target_acceleration: Vector2 = Vector2.ZERO, bullet_acceleration: Vector2 = Vector2.ZERO) -> Vector2 vector3(bullet_speed: float, target_position: Vector3, target_velocity: Vector3, target_acceleration: Vector3 = Vector3.ZERO, bullet_acceleration: Vector3 = Vector3.ZERO) -> Vector3 |
Category | Scripts | Scripts |
License | MIT | MIT |
Repository Provider | GitHub | GitHub |
Repository Url | https://github.com/neclor/ballistic-solutions | https://github.com/neclor/deflection-ballistics-formula-godot |
Issues Url | https://github.com/neclor/ballistic-solutions/issues | https://github.com/neclor/deflection-ballistics-formula-godot/issues |
Godot version | Godot 4.0 | Godot 4.0 |
Version String | 4.0.1 | 1.0.0 |
Download Commit | 491ffeb7be4816d9d913a09fcc37a500c4390f76 | 47909a6e82187094129e48f93b39470b4c628eb8 |
Download Url (Computed) | https://github.com/neclor/ballistic-solutions/archive/491ffeb7be4816d9d913a09fcc37a500c4390f76.zip | https://github.com/neclor/deflection-ballistics-formula-godot/archive/47909a6e82187094129e48f93b39470b4c628eb8.zip |
Icon Url |
https://raw.githubusercontent.com/neclor/ballistic-solutions/main/icon.png
![]() |
https://raw.githubusercontent.com/neclor/deflection-ballistics-formula-godot/main/docs/icon.png
![]() |