0 votes

After searching around, I think that my KinematicBody is not facing -Z but I have no clue how to fix this.

The KinematicBody's "Transform" is all zeros for Translation and Rotation Degrees. My code follows:

const RAY_LENGTH = 1000

onready var camera = $Camera  # Spatial Camera

func _process(delta):    
    if Input.is_action_just_pressed("movement"):  # Right mouse click
        var mouse_position = get_viewport().get_mouse_position()
        var ray_start = camera.project_ray_origin(mouse_position)
        var ray_end = ray_start + (camera.project_ray_normal(mouse_position) * RAY_LENGTH)
        var space_state = get_world().direct_space_state
        var result = space_state.intersect_ray(ray_start, ray_end, [], ENVIRONMENT)
        if result:
            var target_position = result.position
            look_at(target_position, Vector3.UP)

Edit: I tried changing the KinematicBody's Rotation Degrees to 90 but it did not solve the issue.

in Engine by (17 points)

1 Answer

+1 vote
Best answer

your question isn't clear, but try rotating your mesh instances or childrem of the kinematic body to 180,-180,90 or -90.

by (443 points)
selected by

You are correct, instead of rotating my kinematic body, I had to rotate its children. Thank you!

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 Frequently asked questions and 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 [email protected] with your username.