sight-and-light | A programming tutorial for sight & light | Learning library
kandi X-RAY | sight-and-light Summary
kandi X-RAY | sight-and-light Summary
A programming tutorial for sight & light
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sight-and-light
sight-and-light Key Features
sight-and-light Examples and Code Snippets
Community Discussions
Trending Discussions on sight-and-light
QUESTION
I'm trying to test some code to create Vector2 from its angle and its distance from the player position. I've looked up online how to do this and found the Vector2.Angle function to get the angle between two vectors, and the Vector2.Distance function to find the distance between two vectors, and I thought that I would be able to recreate the original (check_points[i]) Vector using these values, but when I run this code this is what I get (the white lines are from position to check_points[i], and the red lines are from position to other, which is the vector I'm trying to create from the values):
I would have expected the red and white lines to be the same, how can I make them this way?
...ANSWER
Answered 2020-Mar-26 at 06:22So the issue is that your position
and check_point[i]
are both positions .. you are not really taking directions here.
As noted in the comments e.g. a position of 0,0,0
wouldn't work at all since this vector has no direction so any angle between this and another position should be undefined.
What you want to do is take directions like Vector2.right
and check_points[i] - position
.
The next issue was that Vector2.Angle
is always positive so you want to rather use SignedAngle
here!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sight-and-light
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page