Skip to content

Projectile-like RigidBody3D loses it's initial velocity when launched from non-zero position with specific direction #95642

Closed as not planned
@ImmortalOctogen

Description

@ImmortalOctogen

Tested versions

  • Reproducible in 4.3.x

System information

Godot v4.3.rc2 - Windows 10.0.19045 - Vulkan (Forward+) - integrated AMD Radeon(TM) R3 Graphics (Advanced Micro Devices, Inc.; 27.20.20913.2000) - AMD A4-9120 RADEON R3, 4 COMPUTE CORES 2C+2G (2 Threads)

Issue description

Sorry for the bad English

I was doing the mechanics of firing physical bullets for my project. When I was shooting in all directions, I noticed that the bullets were quite slow when I shot at the lower and upper angles, equal, as it were, 45 degrees.

Normal velocity, when looking at this direction

Снимок экрана (278)

Low velocity, when looking at THIS direction

Снимок экрана (279)
Also, I found things that somehow make this bug disappear. Take a look at Gun.gd script fragment:

func Launch_Rigid_Body_Projectile(Collision_Data, _proj):
	var _Point = Collision_Data[1]
	var _Norm = Collision_Data[2]
	#var _proj = _projectile.instantiate() # IGNORE THIS LINE
	#$bullet_hint.add_child(_proj) # UNCOMMENT THIS
	add_child(_proj) # AND COMMENT THIS, TO ENABLE BUG
	print(_proj.position)
	#$bullet_hint.call_deferred("add_child", _proj) # IGNORE THIS TOO
	
	_proj.position = $"../Gun/bullet_hint".position # ALSO DISABLING THIS = NO BUG
	var _Direction = (_Point - _proj.global_transform.origin).normalized()
	print(_Direction*1000)
	_proj.set_as_top_level(true)
	_proj.set_linear_velocity(_Direction*1000)

The script consists of parts that I didn't write, so it looks bad.
So, is this a bug, or do I not know something?

Steps to reproduce

  • Download project, launch
    -- Take into account output and Gun.gd. Script prints some position and velocity at the moment of a shot.

Minimal reproduction project (MRP)

velocity trouble.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions