How tracking player's space ship with rocket projectile?[3d]

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bishop
:warning: Old Version Published before Godot 3 was released.

I have a launching rocket projectile and I need to solve the rocket tracking player’s ship
…thanks for all the help.

From time to time the rocket ask player’s ship for his position.
This position is the next position for the rocket to go.

puppetmaster- | 2016-12-29 20:24

:bust_in_silhouette: Reply From: eons

Like a homing missile?
look_at the target and then use the rocket transform basis as translation vector (* rocket speed) for relative speed.

Something like:

set_translation(get_translation()-get_transform().basis.z*speed*delta) 
#if -z is forward on the model

If you want less precision on the follow (slow rotation), I think you will have to use Quad.slerp instead of look_at.

Check this tutorial to see how to work with Quad on Godot:
http://codetuto.com/2016/01/godot-engine-movement-and-rotation-basics/

Thanks for answers, I look at it…this is not so easy for someone who does not know how much programming

Bishop | 2016-12-30 14:54

If you know about 3D design, just go slow, line by line, and make a test scene/project to try stuff until you get yourself oriented on the way things work.

eons | 2016-12-30 15:27