You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the get_rest_info method in Physics2DDirectSpaceState returns a dictionary containing the following fields:
collider_id: The colliding object's ID.
linear_velocity: The colliding object's velocity Vector2.
metadata: The intersecting shape's metadata
normal: The object's surface normal at the intersection point.
point: The intersection point.
rid: The intersecting object's RID.
shape: The shape index of the colliding shape.
The problem is I cannot get the actual collision object from this information. (As far as I know) Both the "collider_id" and "RID" can´t be used anywhere to retrieve the actual object. The instance_from_id function solves my current problem. Although I still think it would be nice to have a collider field in the dictionary or mention the "instance_from_id" function in the documentation for get_rest_info.
The intersect_point, intersect_ray and intersect_shape functions all return a collider (the actual object I am looking for) but get_rest_info does not.
I want to use get_rest_info in combination with cast_motion for a custom projectile system. Without the actual collider object, there is no point for me to use this function. (A projectile needs to interact with the object it collided with for applying damage etc. ) So currently I am using the collide_shape function (returns an array of collision points) with the intersect_ray function to get the results I need.
By looking at the class (Line: 481) responsible for those functions it looks like it should be very easy to add a collider field to the returned dictionary.
An alternative solution to my problem would be to add a function to the Physics2DServer to get the actual object from a RID or the collider_id.
I did not know if I should open a feature proposal or a bug report for this. If it's in the wrong place here I am happy to open a feature proposal instead.
Steps to reproduce
There are no steps to reproduce.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered:
I found it. It is global function in GDScript for anyone having the same issue.
I think it still would be nice to have to collider field in the returned dictionary or at least mention the "instance_from_id" function in the documentation.
Godot version
3.3.2
System information
Windows 10
Issue description
Currently, the get_rest_info method in Physics2DDirectSpaceState returns a dictionary containing the following fields:
The problem is I cannot get the actual collision object from this information. (As far as I know) Both the "collider_id" and "RID" can´t be used anywhere to retrieve the actual object.The instance_from_id function solves my current problem. Although I still think it would be nice to have a collider field in the dictionary or mention the "instance_from_id" function in the documentation for get_rest_info.The intersect_point, intersect_ray and intersect_shape functions all return a collider (the actual object I am looking for) but get_rest_info does not.
I want to use get_rest_info in combination with cast_motion for a custom projectile system. Without the actual collider object, there is no point for me to use this function. (A projectile needs to interact with the object it collided with for applying damage etc. ) So currently I am using the collide_shape function (returns an array of collision points) with the intersect_ray function to get the results I need.
By looking at the class (Line: 481) responsible for those functions it looks like it should be very easy to add a collider field to the returned dictionary.
An alternative solution to my problem would be to add a function to the Physics2DServer to get the actual object from a RID or the collider_id.
I did not know if I should open a feature proposal or a bug report for this. If it's in the wrong place here I am happy to open a feature proposal instead.
Steps to reproduce
There are no steps to reproduce.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: