Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

BDC - Ballistic Deflection Calculator

An asset by neclor
The page banner background of a mountain and forest
BDC - Ballistic Deflection Calculator hero image

Quick Information

0 ratings
BDC - Ballistic Deflection Calculator icon image
neclor
BDC - Ballistic Deflection Calculator

Ballistic deflection calculator is a tool for calculating the shot vector considering speeds and accelerations for Godot.MethodsArray[float] times_to_hit_vector2(...) staticArray[float] times_to_hit_vector3(...) staticArray[float] times_to_hit_vector4(...) staticArray[Vector2] velocities_vector2(...) staticArray[Vector3] velocities_vector3(...) staticArray[Vector4] velocities_vector4(...) staticVector2 velocity_from_time_to_hit_vector2(...) staticVector3 velocity_from_time_to_hit_vector3(...) staticVector4 velocity_from_time_to_hit_vector4(...) staticExampleconst BULLET_SCENE: PackedScene = preload("res://.../bullet.tscn")var bullet_speed: float = 300func shoot(target: CharacterBody2D) -> void:var to_target: Vector2 = target.global_position - global_positionvar bullet_velocities: Array[Vector2] = BDC.velocities_vector2(bullet_speed, to_target, target.velocity)if bullet_velocities.size() == 0:print("impossible to hit the target")returnvar bullet: CharacterBody2D = BULLET_SCENE.instantiate()bullet.global_position = global_positionbullet.velocity = bullet_velocities[0]get_parent().add_child(bullet)

Supported Engine Version
4.0
Version String
2.1.1
License Version
MIT
Support Level
community
Modified Date
14 days ago
Git URL
Issue URL

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)

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
BDC - Ballistic Deflection Calculator icon image
neclor
BDC - Ballistic Deflection Calculator

Ballistic deflection calculator is a tool for calculating the shot vector considering speeds and accelerations for Godot.MethodsArray[float] times_to_hit_vector2(...) staticArray[float] times_to_hit_vector3(...) staticArray[float] times_to_hit_vector4(...) staticArray[Vector2] velocities_vector2(...) staticArray[Vector3] velocities_vector3(...) staticArray[Vector4] velocities_vector4(...) staticVector2 velocity_from_time_to_hit_vector2(...) staticVector3 velocity_from_time_to_hit_vector3(...) staticVector4 velocity_from_time_to_hit_vector4(...) staticExampleconst BULLET_SCENE: PackedScene = preload("res://.../bullet.tscn")var bullet_speed: float = 300func shoot(target: CharacterBody2D) -> void:var to_target: Vector2 = target.global_position - global_positionvar bullet_velocities: Array[Vector2] = BDC.velocities_vector2(bullet_speed, to_target, target.velocity)if bullet_velocities.size() == 0:print("impossible to hit the target")returnvar bullet: CharacterBody2D = BULLET_SCENE.instantiate()bullet.global_position = global_positionbullet.velocity = bullet_velocities[0]get_parent().add_child(bullet)

Supported Engine Version
4.0
Version String
2.1.1
License Version
MIT
Support Level
community
Modified Date
14 days ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers