3
votes
Relative angle in degrees between 2 lines
Did you try even a cursory search for this? It's pretty standard vector math:
...
2
votes
How can I launch a GameObject at a target if I am given everything except for its launch angle?
I modified DMGregory and Evorlor's solution a bit as I wanted a 3D arc and wanted to be able to apply a minimum speed if the provided speed wouldn't reach.
...
2
votes
2d starship combat, hit chances based on bearing and speed (vector)?
You simply need a parametrical equation.
A good way to get how different the 2 ship's angle is is to use dot product on the ship's direction vector and the normalised version of the vector pointing ...
2
votes
Unity C# - Rotate smoothly an object towards the direction given by input
I don't see why you need a coroutine; I think you need Quaternion.Slerp().
Unity give an example of what you want to do in its documentation.
2
votes
Gravity vector and forward vector to local heading (yaw), pitch and roll
I will try to break down the step-by-step questions I'd take to solve this problem, with the hope it helps you to understand how to go about solving vector-related problems in the future.
Note: I'll ...
2
votes
Accepted
3D Thrust velocity
Trigonometry
As stated in this article, 3D rotations (rX, rY, rZ; for their respective axes)...
2
votes
Accepted
How to rotate object just like in the scene?
The (local) transform gizmo shows you rings of possible rotations from the current orientation, about the current local x, y, and z axes respectively.
The Inspector / ...
2
votes
Accepted
Slerp to slerp smoothing
I hadn't actually aligned in CatmullRom, it was one of my other tests. It got lost in all the messy code. The problem was solved by aligning the start and end points of the spline input. (params: pre, ...
2
votes
Accepted
How to clamp a mouse angle within a field of view range of the facing direction
Looks like you need to compare angles and work out their difference.
Here's one way to do it:
...
2
votes
Calculate aim angle dead zone range
Think of the gun as of being parented to the player (conceptually, it inherits player's transform (rotation)). That way, you only need to worry about the local angle (in local space, it's as if the ...
2
votes
Accepted
Rotating only 2 axes of rotation quaternion to "point" in a direction
Following DMGregory's excellent answer and posts linked, I now understand the issue. I have implemented his function provided in one of those answers, and it works beautifully.
This is my solution:
I ...
2
votes
Accepted
How do I apply real time physics to a 2D game in Java?
Don't worry about a package you want to use having more stuff in it than you need. It's unlikely a package will have just what you need... but no more than that.
What's more important is if it can do ...
Almo♦
- 6,708
2
votes
Accepted
Using both look_at and flip_h in Godot
flip_h is making your arm point in the "opposite" direction when you use look_at. A quick, simple solution would be ...
1
vote
Accepted
How to wrap a components position using angles (i.e horizontal compass)
I'd junk this code and do it in a simpler way. ;)
...
1
vote
Accepted
Clockwise / counter-clockwise convention for Vector2.Rotate(float angle)
I was tempted to vote to close this as primarily opinion-based, but we may be able to provide an evidence-based argument here.
I'd recommend that your method rotate counter-clockwise for positive ...
1
vote
Accepted
Top-down 2D push angle velocity
The two options are:
1.) NPCs run away from the player. With this one you just need to take the vector going from the player to the NPC, normalize it and set the NPCs velocity to this vector
2.) ...
1
vote
Accepted
Unity3d: Position a gameobject such that its forms a right angled triangle with other two gameobjects
Taking these two constraints:
"position C gameObject such that it forms a right angled triangle with A and B"
"I want the C to be along the local red axis of A"
We can solve this relatively easily ...
1
vote
Quaternion angle calculation
Calculate the "shadow" on i,j plane $$A\alpha= \sqrt{(Ax)^2+(Ay)^2}$$
Get the γ angle $$\gamma = tan({A\alpha \over Az})$$
Middle solution : $$\alpha'=tan({Ay \over Ax})$$ $$\beta'=tan({Ax \over Ay})...
1
vote
Accepted
360 degree Shooting using Pythagoras problem Unity 2D C#
transform.rotation is a Quaternion, not a collection of angles. Accessing individual components of a quaternion is almost never ...
1
vote
Top down off-screen indicator
use the arctangent to find the angle
angle = Mathf.Atan2(z2-z1), x2-x1) * Mathf.Rad2Deg;
The output is in Radians, so multiplying by ...
1
vote
How to rotate object just like in the scene?
It seems you are trying to tell apart the local from the world space. From the scene, you can press a button next to pivot, to tell apart the local from the ...
1
vote
Accepted
How can I set only the players X rotation to 0 in Quaternion.Slerp in Unity?
Quaternion.LookRotation looks along the vector you pass it. So if you want that rotation to twist only in the horizontal plane, lock the input vector into that ...
1
vote
Accepted
Check whether object is looking in between a minimum and maximum angle in 3d Space
You'll need to get the current direction vector of the object (you can get this with transform.forward in Unity), vectors that point in the directions you care for ...
1
vote
Accepted
Why don't Sin and Cos give expected results when rotating off axis around a non uniform shape?
The length of the lines must always equal the length of the side. If you however multiply sin(angle) by the width of the rect and ...
1
vote
Travel over step angle
Thanks to DMGregory for the sage advice. I needed to get my vectors into the correct world space coordinates . The working code is below, it needs clean up but it works like a champ.
...
1
vote
Accepted
Restrict Up/Down rotation, detect angle upwards/ downwards
With the somewhat limited info you wrote, you could try:
Calculate 3D points (or 2D) for the edge Target.position's, by the allowed maximum angles (-45 and +180 degrees).
Resolve a point exactly in ...
1
vote
Accepted
1
vote
Calculating angle to aim at target results in over/under aim depending on whether target is below/above
Sounds like you just always need to use the players eye position instead of the camera position for the calculation.
1
vote
2d starship combat, hit chances based on bearing and speed (vector)?
Using the angles you provided as example, I took the liberty of assuming a few other data / scenarios.
Let's say you want a 100% hit chance when the angle difference is 0, and have the "good extremes"...
1
vote
Accepted
Unity 3D - Rotate (smoothly) towards a target
There's a few functions for this already in Unity 3D:
Vector3.RotateTowards https://docs.unity3d.com/ScriptReference/Vector3.RotateTowards.html
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
angles × 138unity × 38
mathematics × 31
vector × 30
rotation × 28
c# × 25
2d × 15
trigonometry × 14
quaternion × 12
physics × 9
java × 8
xna × 7
3d × 7
geometry × 7
direction × 7
libgdx × 5
linear-algebra × 5
aiming × 5
gamemaker × 5
collision-detection × 4
camera × 4
box2d × 4
isometric × 4
c++ × 3
unreal-4 × 3