|
|
|
|
Reply From: |
Magso |
transform.xform(player.transform.origin)
Isn’t right but neither would be
transform.basis.xform(player.transform.origin)
Because that would give you the players position as if it is a child of monster.
You need to take the monster’s position away from the player’s position.
player.transform.origin - transform.origin
Thanks for give me confidence in: player.transform.origin - transform.origin
I end up with this $RayCast.cast_to:
$RayCast.cast_to = Vector3(transform.origin.x - player.transform.origin.x, player.transform.origin.z - transform.origin.z, player.transform.origin.y - transform.origin.y + 0.1)
I sit and do one value: X, Y; Z at a time and Debug / Visible Collision Shapes On
my gravity is:
var gravity = Vector3.DOWN * 12
Have I somehow turn my world to Vector3(X, Z, Y)
My $RayCast.cast_to formula make me confused, but it works!
Grrr
I stop the Mob to walking and turning!
When I start make Monster start turn again the $RayCast.castto start go wildly on my screen again!
It’s something with the Monster direction that also somehow is in the calculation too!
Have I somehow turn my world to Vector3(X, Z, Y)
Have you imported a model as the top scene node and parented everything else under it?
In Godot you need to specify an initial node for the scene before anything else, I typically use Node
for maps, Node2D
or Spatial
for anything with a specific custom behaviour and Control
is for UI.
Finally was more easy than expected!
$RayCast.cast_to = $RayCast.to_local(player.transform.origin)
Thanks all for taking time try help me!