The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

I asked This Question earlier but it seems that no one has seen it, so i am asking again the same question
I started using godot a couple weeks ago,
I have a problem so i folllowed the video here: https://www.youtube.com/watch?v=4jbfIN4t83k&t=0s ,when the raycast (the actual raycast)goes from the middle of the screen instead of going from the muzzle thats attatched to the gain,it's working fine:

var raycast = $RayCast
if raycast.is_colliding:
   var collider = raycast.get_collider()
if collider:
   var target = collider
   print(target)

but when the raycast (world raycast) goes from muzzle(which is located in the middle of the gun) to the actual raycast collision point, it's not working,all it detects is the room I am in(Room type is a CSCBox)**

if raycast.is_colliding():
    var bullet = get_world().direct_space_state
    var collision = bullet.intersect_ray(muzzle.transform.origin, raycast.get_collision_point())
if collision:
    var target = collision.collider
   print(target)

heres my character whole code: https://github.com/lowy98/3D/blob/master/Fps_Character
(I don't think there is something wrong with the code tho) let me know if you know what the problem might be,
Thanks,

Note: the raycast is already enabled...

in Engine by (18 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 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.