Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsimulated PhysicalBone3D in skeleton children cannot be detected by intersect_ray #90468

Closed
aiaimimi0920 opened this issue Apr 10, 2024 · 4 comments · Fixed by #93504
Closed

Comments

@aiaimimi0920
Copy link

aiaimimi0920 commented Apr 10, 2024

Tested versions

  • Godot v4.3.dev (04dd299), Godot v4.3.dev (6c57928) have this issue
  • Godot v4.3.dev (fd61a42), Godot v4.2 is no such issue

This issue is due to the commit:
04dd299cbac614c0ff2306b8d3cD60dcd86abd8e
@TokageItLab

System information

windows 11

Issue description

In previous versions(fd61a42), I can obtain ray_result through this code

extends Node3D

const RAY_LENGTH = 1000.0
var ray_result = null
func check_ray():
	var space_state = get_world_3d().direct_space_state
	var cam = %Camera3D
	var mousepos = get_viewport().get_mouse_position()

	var origin = cam.project_ray_origin(mousepos)
	var end = origin + cam.project_ray_normal(mousepos) * RAY_LENGTH
	var query = PhysicsRayQueryParameters3D.create(origin, end)
	query.collide_with_areas = true
	var result = space_state.intersect_ray(query)
	ray_result = result
	printt("ray_result",ray_result)


func _physics_process(delta):
	check_ray()

But in the version(04dd299), I couldn't get the correct result

Steps to reproduce

  1. this is correct video(fd61a42):
2024-04-10.15-02-23.mp4
  1. this is incorrect video(04dd299):
2024-04-10.15-08-04.mp4

node tree is:
image

Note that if the node tree is adjusted to
image
regardless of the version, ray_result can be obtained correctly
The issue should be due to the relevant modifications in Skeleton3D

Minimal reproduction project (MRP)

TestIntersectRay.zip

@fire
Copy link
Member

fire commented May 21, 2024

@TokageItLab Can you look into this?

@TokageItLab
Copy link
Member

TokageItLab commented May 21, 2024

After the start of the simulation by physical_bones_start_simulation(), it seems to be functioning correctly.

I think this issue is caused by the fact that the simulation is explicitly excluded from PhysicsServer3D when it is not running, so it is not detectable from there.

However, since I don't remember changing the registration process of the PhysicsServer3D, I am rather wondering why the past PhysicalBone is still detectable by PhysicsServer3D even though it is not running a simulation. There are performance concerns with having it enabled all the time.

@TokageItLab TokageItLab changed the title intersect_ray has some issues Unsimulated PhysicsBone3D in skeleton children cannot be detected by intersect_ray May 21, 2024
@TokageItLab TokageItLab changed the title Unsimulated PhysicsBone3D in skeleton children cannot be detected by intersect_ray Unsimulated PhysicalBone3D in skeleton children cannot be detected by intersect_ray May 21, 2024
@fire
Copy link
Member

fire commented May 24, 2024

Maybe fixed by #92279

@akien-mga
Copy link
Member

Maybe fixed by #92279

Doesn't seem to be, the MRP is still reproducible in latest master (a6ef250).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Development

Successfully merging a pull request may close this issue.

5 participants