-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Crash calling 2D space intersect_shape with 3D query parameters #17439
Comments
Holy cow, that was a nasty one to figure out 😂 You are working in 2D space which means you need to use the 2D objects. Replace The real issue here is that Godot does not notice that the type is wrong. The crash is because down the line it tries to convert PhysicsShapeQueryParameters into Physics2DShapeQueryParameters which fails silently and results in NULL being passed to the Physics2DDirectSpaceState::_intersect_shape method. As the method does not check for NULL it crashes when trying to access the parameter. I do think that this is a general problem. This most likely will be fixed once GDScript supports typing ( see #10630 ) Working script: func segment_cast(begin_pos, end_pos):
var space_state = ray.get_world_2d().get_direct_space_state()
var segment = SegmentShape2D.new()
segment.set_a(begin_pos)
segment.set_b(end_pos)
var query = Physics2DShapeQueryParameters.new()
query.set_exclude([self])
query.set_collision_layer(2)
query.set_shape(segment)
var hits = space_state.intersect_shape(query, 12) |
Well in this case it's just a missing null check though. GDScript typing will be optional, so it won't solve type mismatches in the case where people don't use the optional typing. |
@reduz the issue is not in GDScript, but in the physics engine (missing an argument check). |
Backtrace with debug symbols (current master):
|
Godot version:
Godot 3.0.2 Stable
OS/device including version:
Win 7 x64
Issue description:
When the project run the intersect_shape( function, Godot crash with this error :
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://git
hub.com/godotengine/godot/issues
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] <couldn't map PC to fn name>
[3] <couldn't map PC to fn name>
[4] <couldn't map PC to fn name>
[5] <couldn't map PC to fn name>
[6] <couldn't map PC to fn name>
[7] <couldn't map PC to fn name>
[8] <couldn't map PC to fn name>
[9] <couldn't map PC to fn name>
[10] <couldn't map PC to fn name>
[11] <couldn't map PC to fn name>
[12] <couldn't map PC to fn name>
[13] <couldn't map PC to fn name>
[14] <couldn't map PC to fn name>
[15] <couldn't map PC to fn name>
[16] <couldn't map PC to fn name>
[17] <couldn't map PC to fn name>
[18] <couldn't map PC to fn name>
[19] <couldn't map PC to fn name>
[20] <couldn't map PC to fn name>
[21] <couldn't map PC to fn name>
[22] <couldn't map PC to fn name>
[23] BaseThreadInitThunk
-- END OF BACKTRACE --
Nothing read: Invalid argument
ERROR: StreamPeerTCPWinsock::read: Server disconnected!
At: drivers\windows\stream_peer_tcp_winsock.cpp:203
Steps to reproduce:
Just run the project and play
Minimal reproduction project:
Bug raycast.zip
Thank you !
The text was updated successfully, but these errors were encountered: