#Invalid call. Nonexistent 'Vector2' constructor.

2 messages · Page 1 of 1 (latest)

narrow mountain
#

It's because there is no constructor that takes a single float. You want something more like Vector2(x, y), not just Vector2(x), which is what you are doing.

dapper flax
#

So I did try that as well.

Example:

func adjust_reticle_lines():
    var vel = PLAYER_CONTROLLER.get_real_velocity()
    var origin = Vector3.ZERO
    var pos = Vector2(0, 0)
    var speed = origin.distance_to(vel)
    
    RETICLE_LINES[0].position = lerp(RETICLE_LINES[0].position, pos + Vector2(0, -speed * RETICLE_DISTANCE), RETICLE_SPEED) # Top LINE
    RETICLE_LINES[1].position = lerp(RETICLE_LINES[1].position, pos + Vector2( speed * RETICLE_DISTANCE, 0), RETICLE_SPEED) # Right LINE
    RETICLE_LINES[2].position = lerp(RETICLE_LINES[2].position, pos + Vector2(0, speed * RETICLE_DISTANCE), RETICLE_SPEED) # Bottom LINE
    RETICLE_LINES[3].position = lerp(RETICLE_LINES[3].position, pos + Vector2( -speed * RETICLE_DISTANCE, 0), RETICLE_SPEED) # Left LINE

this still fails with the same error.