Edit of asset "BDC - Ballistic Deflection Calculator" Accepted
Old/Current | New/Edit | |
---|---|---|
Title | BDC - Ballistic Deflection Calculator | Deflection (ballistics) Formula |
Description |
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) |
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/godot-ballistic-deflection-calculator | https://github.com/neclor/deflection-ballistics-formula-godot |
Issues Url | https://github.com/neclor/ballistic-deflection-calculator-godot/issues | https://github.com/neclor/deflection-ballistics-formula-godot/issues |
Godot version | Godot 4.0 | Godot 4.0 |
Version String | 2.1.1 | 1.0.0 |
Download Commit | 8113da0864d935d1987a9fa437b72424f4b0be5b | 47909a6e82187094129e48f93b39470b4c628eb8 |
Download Url (Computed) | https://github.com/neclor/godot-ballistic-deflection-calculator/archive/8113da0864d935d1987a9fa437b72424f4b0be5b.zip | https://github.com/neclor/deflection-ballistics-formula-godot/archive/47909a6e82187094129e48f93b39470b4c628eb8.zip |
Icon Url |
https://raw.githubusercontent.com/neclor/ballistic-deflection-calculator-godot/main/icon.png
![]() |
https://raw.githubusercontent.com/neclor/deflection-ballistics-formula-godot/main/docs/icon.png
![]() |