translation interpretation problems between kinematics global positioning

dee200dee200 Posts: 3Member
in 3D

so my issue is using two simple statements

global_transform.origin.distance_to

global_transform.origin.direction_to

I know this the wrong way to wright these two lines off code i'm hoping someone could assit me in finding the correct way

Comments

  • dee200dee200 Posts: 3Member
        if PLAYER.global_transform_origin.distance_to(Moniter_mode.target_position) <= WANDER_RANGE:
        update_wander()
    

    trying to make it walk around if the player is not in its vision zone

  • TwistedTwiglegTwistedTwigleg Posts: 4,201Admin

    Looking at the code, I think it should work. Is Moniter_mode.target_position in global space or local space? If its in local space, then you will need to add the global position of the node first:

    PLAYER.global_transform_origin.distance_to(Moniter_mode.global_transform.origin + Moniter_mode.target_position) <= WANDER_RANGE:
    

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file