# Questions tagged [angles]

The tag has no usage guidance.

101 questions
7 views

### Quaternion angle calculation

I'm working on a programming project, in this project I'm receiving an angle as a quaternion value, I partially understand how they work but I don't find any math to get the values I need. What I ...
50 views

### Find if one player is visible to the other

Two players (p1 and p2) are standing in a 3D space, represented by points (x1, y1, z1) and (x2, y2, z2). Player 2 is holding a light source, pointing in the direction given by a normalised vector (xn, ...
20 views

### 360 degree Shooting using Pythagoras problem Unity 2D C#

I have used pythagoras to give the bullet a velocity in the bullet class. Velocity is applied when Instantiated(); ...
18 views

### How to determine angle of incidence, resulting position, and resulting velocity for a point with position and velocity appearing within a rectangle?

I have a rectangle positioned on a 2D Cartesian coordinate system, and its minimum x and minimum y are represented as a coordinate pair (xrect, ...
34 views

### How do I rotate finger joints using controller input?

Suppose I have an index finger composed of 3 cubes which all contain Rigidbody which have isKinematic set to true. In a ...
80 views

### Find hexes on a hex grid given an angle

I'm trying to find an elegant solution to calculating the x, y values of hexes that are crossed or intersected by a line or ray at a given angle from a given hex position on a hex grid. I do not want ...
69 views

### How to rotate object just like in the scene?

Look at this image, I selected an object and pivot is set to local: When I rotated selected object in the scene by X axis, it rotates exactly I wanted. But if I rotate axis from inspector or script, ...
41 views

### Object is not rotating from right direction

im beginner to unity so im using this code to rotate object with mouse with max rotation of 35 degrees,it is working but it's only possible to rotate object if mouse is under of that object. here is ...
400 views

### How can I set only the players X rotation to 0 in Quaternion.Slerp in Unity?

I want to set the players X axis to zero while he is turning to the target Object but I dont get it to work. Code: public float rotationSpeed; ...
18 views

### C4d or 3DS-like matrix rotations

I have a rotation 4x4 matrix to generate a model matrix, but I would like to be able to control it like cinema4D or 3ds Max with three separate angles that are always perpendicular to each other, and ...
61 views

### Check whether object is looking in between a minimum and maximum angle in 3d Space

What I want to accomplish is to check whether an object is looking in between a minimum and maximum angle in 3D space for example if a Helicopter is looking to the right... it would have to check ...
59 views

### Why don't Sin and Cos give expected results when rotating off axis around a non uniform shape?

When I rotate a rectangle and draw straight lines along it's edge using Sin and Cos the lines don't follow the edge as the angle approaches 45 degrees, why? The exact same code works just fine when I ...
240 views

### Relative angle in degrees between 2 lines

Could anybody help to solve this? Relative angle between 2 rays(lines) which starts from same point. They could point anywhere 360 clockwise, but angle should be always relative (just inside angle).
227 views

### How to wrap a components position using angles (i.e horizontal compass)

I'm trying to make a horizontal compass. The compass is made up of UI components: panel (with mask), with a child UI Image (the compass image). Here is the compass from Fallout: As you turn around, ...
182 views

### 3D Thrust velocity

How do I create 3D velocity with a 3D angle and 1D thrust like the 2D algorithm below? ...
56 views

### Travel over step angle

http://www.gamasutra.com/blogs/AdamWinkels/20140220/211306/DevLog_7_Learning_How_to_Walk.php Following the link above I have been able to get my character to move and rotate very smoothly over angled ...
133 views

### Restrict Up/Down rotation, detect angle upwards/ downwards

I have an object using Quaternion.LookRotation() to look at target object, I would like to be able to restrict the rotation by being able to set the range that the object can rotate at, for example ...
994 views

### Unity look at rotation on one axis only problem

Hey I would like an object to look at another object only at one axis, when I rotate the white cube all around the gray cube (gray has look at script), the gray cube flips as soon as the target passes ...
127 views

### Calculating angle to aim at target results in over/under aim depending on whether target is below/above

I'm calculating the angle (in radians, ranges -3.141 to 3.141 for yaw and -1.343 to 1.396 for pitch) to aim at in order to aim at a target position. The data I have is my local world camera position, ...
598 views

### Transform.Rotate() rotation about one axis also rotates about the other axes [duplicate]

i'm new to learning unity and infact game development.Below i have setup a scene to learn about unity and i have encountered a strange problem that doesn't comply with anything that unity has ...
522 views

### Gravity vector and forward vector to local heading (yaw), pitch and roll

I've looked around for hours and I simply don't get it. I am the first to admit I am severely lacking in mathematics. So please, keep it simple. I am trying to get a vectors rotation (angle) around ...
71 views

### 2d starship combat, hit chances based on bearing and speed (vector)?

Thinking about a 2d strategy game, where you move your starships turn by turn and fire guns at each other. Instead of the traditional approach of "range" lowering hit chances, im thinking about some ...
323 views

### Changing a direction Vector with Euler angles

It seems like an easy problem but I somehow didnt got to the solution. I need the Maths to change the Vector based on Euler angles. Example Problem: I have an direction Vector- for example: Showing ...
149 views

### What is wrong with this character slope math?

I'm making a sidescrolling platformer and have implemented some code that should convert the characters speed to an X speed and Y speed based on the angle of the surface they are on. This actual math ...
358 views

### Box2D body rotation problem

When my player jumps, I start a rotation and I want to finish it when he gets back on the ground. My Player is jumping off the ground and landing back on in 1 second. My physics are updating at 10 ...
1k views

### Unity C# - Rotate smoothly an object towards the direction given by input

I am trying to rotate an object towards the direction given by de direction of the input. For example, if I am pressing 'up' of the directional pad, the player should rotate pointing that direction. ...
4k views

### Unity 3D - Rotate (smoothly) towards a target

I wanted to know if there is a method on which I can rotate an object with an angle given (a float to be precise), I use trigonometry to calculate the angle between the two objects in a (x, z) plane ...
333 views

### Calculate target angle to a certain Vector

I'm developing a 3D game in LWJGL. I have a player class and a monster class and I need the monster class to chase the player when the player is within a certain distance. For that I have the monster ...
223 views

### Unity3D: Find Raycasthit direction

I'm trying to make a Billiard game and I wanna calculate the direction on which the Cue Ball(white ball) will be moving after it hits another ball. As you can see I wanna calculate the angle/...
262 views

### Change sprite angle on sloping ground

I have a problem here with GameMaker built-in physics environment.My player is designed to be on a skateboard. I want my player to rotate its sprite, according to the kind of fixture(up or down slopes)...
81 views

### Targeting system, Vectors and Angles Maths

I need a bit of help with the maths for a targeting system for a space simulator. The problem is working out the correct turret angle so that the bullets hit the target ship... I have a ship at ...
70 views

### Algorithm for spacing points out among a line

I'm writing an angled tile system, and my implementation is to have a starting height and an ending height inside the tile. Like so: The starting and ending height allow me to get the length of the ...
85 views

### How do you convert angle with velocity to x velocity and y velocity?

This question can be simplified to: If you lean a pencil of a certain length at a certain angle what is the x and y position of the tip? So, basically, I am making a game that plots a balls path ...
448 views

### Using angle_difference to calculate shortest turn to target [Gamemaker]

I've tried, but I cannot understand angle_difference. I have an object, oTurretDetTurret, which turns to face its ...
41 views

### Light intensity on plain from angle

Given a vector (v) for the direction of light and a vector (n) for the normal of a plain. How can I calculate a rudimentary intensity value (i) where ...
129 views

### UNITY 3D - Get X and Y components relative to a value and an angle

I have an algorithm, that, once the gameObject collides with a trigger, a method is called, on which the current collectibles (almonds) picked are instanciated around the circular area of the ...
667 views

### Rotate smoothly object to angle (Y axis) of the collided object

Well, let's say I have two planes, one which I am moving, and another one that I collide with, that has a different y rotation. I want to make that, once both planes collide, the plane the user ...
507 views

### In Game Maker Studio, why does the image rotation have to be performed every step?

I'm a software developer who's trying to get into game development casually on the side. I picked up Game Maker Studio a while ago on a Steam Sale, and I'm finally getting into using it, especially ...
84 views

### Object has its heading stored as Euler angles. After it makes a turn, how do I calculate the new angles?

Assume said object is an aircraft. I store three angles (in degrees) that describe where it's headed: yaw, pitch and roll - in that order. Let's say the plane is flying vertically, upwards. The angles ...
936 views

### How does this math behind converting angles to vectors work?

I calculated the vectors of my yaw and pitch successfully. Even tho it works fine, I can't seem to understand how the math works exactly. Could someone (graphically / demonstratively) explain me this ...
203 views

### Unexpected quaternion rotation behavior

First off let me apologize for the vague title but I really couldn't think of a more descriptive one (maybe after reading this a more advanced user might be able to edit it). Alright, so I have been ...
1k views

### How do I set angular velocity/torque so that it's pointing to velocity/direction?

Right now, when I spawn a shootable object, it goes like this: Because I just set it's angle to this: ...
2k views

### How can I launch a GameObject at a target if I am given everything except for its launch angle?

I am trying to launch an object at a target, given its position, its target position, the launch speed, and the gravity. I am following this formula from Wikipedia:  \theta = arctan \bigg( \frac{v^...
613 views

### How do I make a box don't slide up/walk normally on a slope?

I'm trying to implement slopes in my game. When I walk up the slope and suddenly stop, here is what happens: And when I move down, it goes like this: I have set density to 0.5, friction to 0 on both ...
590 views

### Drawing a lines radiating from every angle using Bresenham line algorithm

I am trying to recreate a image like this ... or just each point Using Bresenham line algorithm, but can't seem to able to do so.. The point i receive from my computation doesn't look like a like, ...
4k views

### Most efficient way to calculate angle between two line-segments that do not necessarily touch each other

Although I found answers on calculating angles from vectors, I didn't find a specific way to calculate angles between line-segments that do not necessarily touch each other (I say "not necessarily ...
78 views

### How to get a difference of angles in one mathematical expression? [duplicate]

I need to do this for AI and also range calculation over a curved surface. I have two angles, a1 and a2, which can be in the range from 0 to 359. I need to calculate the difference between them, and ...
375 views

### 3D 3-axes rotation into 3D 2-axes rotation

Hello everyone and thanks in advance to anyone who'll help me through this ! I am currently working on the Kinect V2 (for XBox One) to interact with an avatar. I'd like to use the rotation quaternion ...