GodotVR / godot-xr-tools

Support scenes for AR and VR in Godot
MIT License
514 stars 74 forks source link

Grapple Interaction Collision Detection Gridmap Error #541

Closed AinsRuby closed 10 months ago

AinsRuby commented 1 year ago

Hi, I'm attempting to use a Gridmap with collision on the tiles in my scene, due to the ease of use, and the grappling keeps crashing the project due to this line of code. var target : CollisionObject3D = _grapple_raycast.get_collider() Wondering if it would be possible to somehow get it working with a gridmap, or if I have to just use normal objects in my scene. Any help would be appreciated!

Malcolmnixon commented 1 year ago

What version of Godot are you using? I encountered something similar recently and it was caused by the _grapple_raycast.is_colliding() returning true but _grapple_raycast.get_collider() returned null.

Godot 4.1.x supports priorities on physics-processing, and it might be something to do with that. We mess with priorities to prevent latency issues with items in the players hands, but it may cause the raycast to not update. I'll look into this issue shortly.

Malcolmnixon commented 1 year ago

My problem was caused by trying to get the RayCast3D to return a Node that had just been destroyed. I suspect your problem is that a GridMap does not extend from CollisionObject3D. Could you try the attached script and see if it works for your case?

movement_grapple.gd.zip