0 votes

Hi all,

I have a Raycast as a child of my camera, which in turn is a child of my character.

When moving the camera I get the correct collision point from the Raycast. If I add gravity though, even when the character is staying still the collision point deviates by a considerable amount. Example values are:

(-0.81121, 0.076689, -6.694593)
(-0.853282, 0.028879, -7.04114)
(-0.70973, 0.192567, -5.854981)
(-0.844342, 0.038993, -6.967905)
(-0.680005, 0.226524, -5.609015)

Relevant code in physicsprocess:

var movement = Vector3()
vertical_speed = clamp(vertical_speed - delta * 20, -9.8, 100)
# movement.y += vertical_speed
move_and_collide(movement)

if $Camera/RayCast.is_colliding():
    var point = $Camera/RayCast.get_collision_point()
    print(point)

Relevant code in _input:

if event is InputEventMouseMotion:
    $Camera.rotation_degrees.x = clamp($Camera.rotation_degrees.x - event.relative.y * 0.1, -89, 89)
    $Camera.rotation_degrees.y -= event.relative.x * 0.1

Any idea why that would be the case?

Godot version 3.2.3 stable
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.