1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Updated tutorial_raycasting (markdown)

Juan Linietsky
2015-04-24 20:46:18 -03:00
parent d6a396f2dd
commit b4a7a19db4

@@ -87,9 +87,11 @@ extends KinematicBody2D
func _fixed_process(delta): func _fixed_process(delta):
var space_state = get_world().get_direct_space_state() var space_state = get_world().get_direct_space_state()
var result = space_state.intersect_ray( get_global_pos(), enemy_pos, [ get_rid() ] ) var result = space_state.intersect_ray( get_global_pos(), enemy_pos, [ self ] )
``` ```
The extra argument is a list of exceptions, can be objects (need Godot 1.1beta2+ for this) or RIDs.
### 3D Ray Casting From Screen ### 3D Ray Casting From Screen
Casting a ray from screen to 3D physics space is useful for object picking. There is not much of a need to do this because [CollisionObject](class_collisionobject) has an "input_event" signal that will let you know when it was clicked, but in case there is any desire to do it manually, here's how. Casting a ray from screen to 3D physics space is useful for object picking. There is not much of a need to do this because [CollisionObject](class_collisionobject) has an "input_event" signal that will let you know when it was clicked, but in case there is any desire to do it manually, here's how.