Page MenuHomeFeedback Tracker

[Feature Request] New vector operation command: VectorCos2D
Closed, ResolvedPublic

Description

Sometimes you just want to get the angle between the projection of two vectors in the X-Y plane. But having to use _vec set [2,0] on both of these vectors is just a waste of performance.

The difference between this command and vectorCos would be that it completely ignores the Z component (like distance2D). Very useful for faster vector operations (especially per frame operations)

Command syntax:
vector1 vectorCos2D vector2

vector1: 2D or 3D vector (Z component is ignored)
vector2: 2D or 3D vector (Z component is ignored)

return: Number - cosine of angle between the two vectors in the X-Y plane

Details

Severity
Feature
Resolution
Fixed
Reproducibility
N/A
Operating System
Windows 7
Category
Feature Request
Additional Information

Complementary commands:
VectorFromTo2D: https://feedback.bistudio.com/T152658
vectorAdd2D/vectorDiff2D: https://feedback.bistudio.com/T152659

Event Timeline

Leopard20 updated the task description. (Show Details)Jul 13 2020, 6:27 PM
Leopard20 updated the task description. (Show Details)
Leopard20 updated the task description. (Show Details)
Leopard20 edited Additional Information. (Show Details)Jul 13 2020, 7:57 PM
Leopard20 edited Additional Information. (Show Details)Jul 13 2020, 8:11 PM

Added support for 2d vectors in 1.99.146539

BIS_fnc_KK closed this task as Resolved.Jul 19 2020, 6:18 PM
BIS_fnc_KK changed Resolution from Open to Fixed.
Leopard20 added a comment.EditedJul 19 2020, 6:55 PM

@BIS_fnc_KK
Thank you, but just a question (this question applies to all of my requests but I'm asking just one here).

Have you added a new command or have you added support for 2D vectors in vectorCos? If the latter, it doesn't really cover my request. Because as mentioned in the request, I want the 2D cos even for a 3D vector. (it has to be a separate command, similar to distance vs distance2D)

For example, if I used:

[1,1,1] vectorCos2D [1,1,0]

The result should be 1, identical to:

[1,1] vectorCos2D [1,1]

Because Z component is ignored.

Basically, it's a completely different operation for a different purpose (checking horizontal alignment).

BIS_fnc_KK added a comment.EditedJul 19 2020, 8:09 PM

[1,1] vectorCos [1,1] = 1
[1,1,1] vectorCos [1,1,0] = 0.816497

You can resize any 3d vector prior to operation https://community.bistudio.com/wiki/resize the resizing is lightning fast

[1,1] vectorCos [1,1] = 1
[1,1,1] vectorCos [1,1,0] = 0.816497

You can resize any 3d vector prior to operation https://community.bistudio.com/wiki/resize the resizing is lightning fast

Oh great tip! I didn't think of that! Thanks KK!