0 votes

Example image: https://imgur.com/KT14qbz

I have the values of A, B,C known i want to be able to place points like D, E on the perpendicular.

Essentially im trying to place points on that perpendicular that are X away from A.

What would the formula for those be?

godot perpendicular help

in Engine by (15 points)
recategorized by

1 Answer

+2 votes
Best answer

There's any number of ways to get a rotated vector. Here's one...

var dist = 2
var v1 = Vector2(10, 10)
var v2 = v1.rotated(90 * PI / 180).normalized() * dist
var v3 = v1.rotated(-90 * PI / 180).normalized() * dist

There, dist is the distance along the rotated vectors to project your points (X away from A in your description).

v1 is the original vector (AB in your description)
v2 and v3 are the rotated (+90 and -90 degrees) vectors, of length dist

by (16,758 points)
selected by
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.