# Tagged Questions

A branch of mathematics that studies triangles and the relationships between their sides and the angles between these sides.

22 views

### Turning x and y difference between two points into a projectile moving between them at a fixed speed

In a libgdx project of mine, I have two units on a 2d field who want to fire at each other. They both know the x and y distance to each other by subtracting their enemies position from their own: ...
56 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 ...
16 views

### Slide along Surface

I'm very bad at Math and trigonometric functions (And I dunno if this questions fits here) I have a surface normal as a direction vector.I want my character slide along the surface, if the angle of ...
62 views

### Why does this whirlpool simulation not work?

I am trying to create a simple whirlpool simulation, where particles are constantly compelled to move towards a point in a whirlpool like fashion. To do this I do the following (in sudo code) ...
80 views

### How to avoid 2d enemy using trigonometry?

I'm making a game in Javascript & HTML5. I have a "bullet" (let's call it so) that needs to reach the enemy (at fixed position) and that need to avoid the enemy's "bullet". To make the bullet ...
33 views

### How to rotate a triangle to look at a point?

Lets say I have a triangle defined by 3 vertices and a center point, how do I rotate the triangle so its normal is looking at a specified point?
40 views

### Java- Trig based movement

I have been trying to create a smooth movement technique that would allow me to move in all directions, not just the 8 cardinal directions. I have tried to use this doing trig, and while the ...
464 views

### Guided Missile with Constant Time

I'm building a game with players and missiles. I want to fire a missile from P1 to P2. The missile should always take exactly five seconds to reach P2. The missile should also track P2. If P2 moves ...
20 views

### Trigonometric movement cause problem when holding player inside bounds

In my game I have a Player class. Here is what it looks like. public void Update(GameTime gameTime) { // Controls kb = Keyboard.GetState(); if (kb.IsKeyDown(Keys.W)) ...
29 views

### How does this point2LineDist() method works?

I was browsing Wolf3D JS port and bump into that method : /** * @description calculates distance between a point (x, y) and a line. * @memberOf Wolf.Math * @param {number} x X coord of point * @...
53 views

### Require maths help calculating deflection angles of quadrants

For each quadrant, I need to find a neat way of calculating the deflection angle for a small circular object striking a circle, as shown in the diagram. Angles a and b are already known. Angle a ...
164 views

### OpenGL Arc-Ball Camera Yaw Pitch GLM::Rotate

I'm currently working on a small Voxel-Editor Project. In the editor, I plan on using an Arc-Ball camera which rotate around the model. My camera is currently working but in an odd way. I can't seem ...
123 views

### Day/Night - Rotation from a sine wave

I recently found this question on stack exchange with a great answer that showed how to condense game time into a sine wave, where 1 = midday and -1 = midnight Converting time of day into a smooth ...
69 views

I'm using Shader-toy to experiment and try to learn a bit the shader science. As exercise I wan to replicate some of the wikipedia math plots. I've started with a Super Formula. What I want to ...
36 views

### How to enforce touching within a ring shape?

I'd like to have the player moving the finger within the shaded ring: The game should be able to detect "out-of-boundary" events once the finger moves outside the ring. How can I accomplish this?
104 views

### Counter-clockwise angle limit

I'd like to limit rotation of an object, so I've written following snippet: if (targetRotation < constraintMin) { targetRotation = constraintMin; } else if (targetRotation > constraintMax) {...
146 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, ...
113 views

### How to calculate a vector for multi-axis rotations from sphere coordinates?

I'm working on a SceneKit project in iOS, trying to rotate a sphere (representing a planet) so that a point at a given longitude/latitude coordinate is facing "forward" (i.e. that point moves to the {...
44 views

### Rotation of rectangles offsets render position

I have an unknown number "Bricks" that must follow a straight, but not always level, path. Each brick is rotated around one central point properly to form a shape of intersecting paths. My problem ...
326 views

### How do I make a sine wave without using an infinitely-increasing time value as input?

I have a basic understanding of sine wave generation. The problem I am facing is that as the input parameter for time gets larger, my sine wave falls apart and starts to look really ugly. I'd like to ...
36 views

### add the variation of the angle to its current angle: trouble with 180 and -180

I need to rotate a character, I would like to add the variation of the angle to its current angle. But my values are between 180 and -180. So if my character is at -179, then he goes right, it arrives ...
88 views

### How to find the point on a hypotenuse divinging triangle into two right triangles?

Consider the following image: Knowing the (x,y) coordinates of A, B, and C; how would one find the point D? D being the point where line CD cuts the triangle into two smaller right triangles? I ...
55 views

### Need help solving an acute-triangle to find the distance to the outside of my object

I recently asked a question here: How would I check the range against the entirety of an enemy object, and not just it's transform.position? That was accurately answered, and works perfectly fine....
57 views

### How to make a joystick follow the touch around a starting point using atan2?

I would like to move a joystick, and be able to go beyond the limit of the circle, and the joystick should follow the angle from the touch (the touch is moving), but it should stay on the circle. It ...
194 views

### How to use atan2 to get the correct angle? (inside or outside angle) [duplicate]

I would like to rotate an object (white rectangle) towards another object (black rectangle). EDIT: the white rectangle (at the top) has a camera. I finally rotated the camera by 180 around the "y" ...
81 views

### atan2 : inversed result? (angle 180 is on the right side, angle 0 on the left side)

the result of the angle between my touch and the middle,bottom of the screen gives me 180 when the touch is on the right side of the screen, and 0 when it is on the left. I don't understand why... ...
150 views

### How to move dashes towards target?

Would you know how to create a dash line that moves towards the direction of the target, and if it collides with a wall, goes to the opposite angle? I have seen atan2 but I am not sure what it does, ...
68 views

### How can i calculate that normal lays in same part of plane with point?

I.e. n0 for A and n1 for B. Plane divided by plane CD.
752 views

### Calculating Projectile Movement

I'm having some trouble putting together a method that will constantly move a "bullet" in the same direction accurately. Here is what I have so far public Vector3f moveFromPosition(Vector3f location, ...
254 views

### Unity2D Best way to determine degrees between two colliding entities?

I'm trying to determine the collision-direction between two objects. I'll be using this for various things such as creating blood-entities in a specific direction proportional to where the other ...
2k views

### How to calculate a direction vector for camera?

I have a vector that describes change in movement, and I have a 3d-vector, m_rot, that describes a rotation given to an object. I want to calculate a direction vector using both this data. How to ...
41 views

### Predicting circle-circle bounce vector when aiming one at another

I am making a game with libGDX (with box2d) in which you drag and aim one circle body at another then release to fire. I would like to be able to predict the path of the second circle based on the aim ...
46 views

### Point to coordinate function

I am working on a game in which I need an enemy ship to point towards the player. Here is the equation I came up with: angle = sin-1(abs(y1 - y2)/√(x1 - x2)2-(y1 - y2)2) This essentially takes ...
213 views

### Is Physics a prerequisite to learn Unity3D

I have got a basic knowledge about the Unity 3D platform but I coding in Unity has not been that easy for me. For the simple reason I can see is, I cannot understand which function to use for what ...
12k views

### How do I generate projectiles toward the mouse pointer? [duplicate]

I'm making a top-down space shooter where the player controls a ship and can aim and shoot using the mouse cursor. How can I fire bullets from the ship at the angle from the ship to the mouse cursor?
356 views

### Bullet entry Point around Player Object

I have a player rotating by the mouse and want the bullets line up with the player's gun. Right now they simply come from the point of the player and shoot in the direction of mouse. I just need the ...
305 views

### determine collision angle on a rotating body

update: new diagram and updated description I have a contact listener set up to try and determine the side that a collision happened at relative to the a bodies rotation. One way to solve this is ...
268 views

### How do I find the camera direction vector for 3D sound purposes? (C++, DirectX)

Question I'm trying to make a sound class for playing 3D sound effects with DirectSound and DirectX, without using DirectSound's 3D libraries. The plan is to have every game object constantly play ...
7k views

### How do I make an entity move in a direction?

I have an Entity instance which is updated every game tick. Let's just assume that entity moves forward constantly. I'd like to be able to give the entity's angle to a function that makes it move in ...
60 views

### How to find optimal perpendicular axis of rotation vector to draw arrows?

I am drawing lines on the screen. Each line has a point (x,y,z) and a direction (u,v,w). I want to draw arrow heads on these lines, like two lines that start from (x,y,z) and leave at a 15 degree ...
172 views

### 3D Camera Y-Axis wrong angle

I am trying to build a camera class, though I am running into a problem. When I move the camera above/below, and try to move towards the ground, I am moved off in what seems to be about 45 degrees in ...
233 views

### How can I fix my sprite being rotated 90 degrees more than toward the mouse?

I am trying to get a Sprite in LibGDX to look at the player's mouse. Here's the code I have (mind you, I am using JRuby): target = mouse_position.sub(spatial.position) rotation = MathUtils.atan2(...
94 views

### How do I lock drawn lines to be orthogonal to an existing one?

I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to ...
136 views

### infer half vector length in BRDF

it's my first question on stack. Is it possible to infer length of the half angle vector for specular lighting from N·L and N·V without the whole view and light vectors? I may be completely off-track, ...
468 views

### How do I find two points at an angle on opposite sides of a circle?

With reference to my previous question: I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to ...
685 views

### breakout game, computing optimal ricochet angle of a ball to get to a certain point

perhaps the title isn't clear so here is an explanation with a picture to better express my question Consider the following breakout clone game where the game is rigged to change the ricochet ...
154 views

### “Walking” along a rotating surface in LimeJS

I'm trying to have a character walk along a plank (a long, thin rectangle) that works like a seesaw, being rotated around a central point by box2d physics (falling objects). I want the left and right ...
2k views

### How to shoot on direction of touch

I'm new to the Corona SDK(and I also suck in trigonometry) and I'm trying to achieve this: Shoot a bullet from the player, towards the direction of the point the user touched, but always with ethe ...