Skip to main content
added 26 characters in body
Source Link
modernator
  • 1.2k
  • 2
  • 19
  • 49

I'm using RayCast node to check the object is grounded. Here's the setting:

enter image description here

RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled.

RayCast node is child node of FPSController node, and here's the code of FPSController that processing grounded logic:

onready var ground_check_raycast: RayCast = $GroundCheckRayCast

func _physics_process(delta):
    process_grounded(delta)

func process_grounded(delta):
    var hit_collider = ground_check_raycast.get_collider()
    print(hit_collider)

When I run the game, first few times it return floor, and then immediately return false and never return floor back.

** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
[StaticBody:1140]
[StaticBody:1140]
[StaticBody:1140]
[Object:null]
[Object:null]
[Object:null]
[Object:null]
...

I have no idea why this won't work. Is there a something that I missed?

P.S. Floor object has static body and CollisionShape. P.P.S. Using Godot 3.1.1

I'm using RayCast node to check the object is grounded. Here's the setting:

enter image description here

RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled.

RayCast node is child node of FPSController node, and here's the code of FPSController that processing grounded logic:

onready var ground_check_raycast: RayCast = $GroundCheckRayCast

func _physics_process(delta):
    process_grounded(delta)

func process_grounded(delta):
    var hit_collider = ground_check_raycast.get_collider()
    print(hit_collider)

When I run the game, first few times it return floor, and then immediately return false and never return floor back.

** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
[StaticBody:1140]
[StaticBody:1140]
[StaticBody:1140]
[Object:null]
[Object:null]
[Object:null]
[Object:null]
...

I have no idea why this won't work. Is there a something that I missed?

P.S. Floor object has static body and CollisionShape.

I'm using RayCast node to check the object is grounded. Here's the setting:

enter image description here

RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled.

RayCast node is child node of FPSController node, and here's the code of FPSController that processing grounded logic:

onready var ground_check_raycast: RayCast = $GroundCheckRayCast

func _physics_process(delta):
    process_grounded(delta)

func process_grounded(delta):
    var hit_collider = ground_check_raycast.get_collider()
    print(hit_collider)

When I run the game, first few times it return floor, and then immediately return false and never return floor back.

** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
[StaticBody:1140]
[StaticBody:1140]
[StaticBody:1140]
[Object:null]
[Object:null]
[Object:null]
[Object:null]
...

I have no idea why this won't work. Is there a something that I missed?

P.S. Floor object has static body and CollisionShape. P.P.S. Using Godot 3.1.1

Source Link
modernator
  • 1.2k
  • 2
  • 19
  • 49

RayCast node always return null

I'm using RayCast node to check the object is grounded. Here's the setting:

enter image description here

RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled.

RayCast node is child node of FPSController node, and here's the code of FPSController that processing grounded logic:

onready var ground_check_raycast: RayCast = $GroundCheckRayCast

func _physics_process(delta):
    process_grounded(delta)

func process_grounded(delta):
    var hit_collider = ground_check_raycast.get_collider()
    print(hit_collider)

When I run the game, first few times it return floor, and then immediately return false and never return floor back.

** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
[StaticBody:1140]
[StaticBody:1140]
[StaticBody:1140]
[Object:null]
[Object:null]
[Object:null]
[Object:null]
...

I have no idea why this won't work. Is there a something that I missed?

P.S. Floor object has static body and CollisionShape.