# Tagged Questions

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

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?
2k views

### How can I draw an arrow at the edge of the screen pointing to an object that is off screen?

I am wishing to do what is described in this topic: http://www.allegro.cc/forums/print-thread/283220 I have attempted a variety of the methods mentioned here. First I tried to use the method ...
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 ...
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 ...
6k views

### How to rotate camera centered around the camera's position?

Currently I am using gluLook at like so: gluLookAt(position.x, position.y, position.z, viewPoint.x, viewPoint.y, viewPoint.z, upVector.x, upVector.y, upVector.z); with the above,...
1k views

### Spherical to Cartesian Coordinates

Well I'm reading the Frank's Luna DirectX10 book and, while I'm trying to understand the first demo, I found something that's not very clear at least for me. In the updateScene method, when I press A, ...
138 views

### Propel entities at some angle (depending on explosion's position)

I have a 2D platformer. There are multiple particles that are just 1x1 colored pixels. Let's assume there are 256 particles laid out as a 16x16 cube. Say I popped an explosion right in the middle. All ...
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 ...
682 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 ...
67 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 ...
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) {...
303 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 ...
2k views

### Raycasting “fisheye effect” question

Continuing my exploration of raycasting, I am very confused about how the correction of the fisheye effect works. Looking at the screenshot below from the tutorial at permadi.com, the way I ...
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 ...
5k views

### How to detect if object is moving in clockwise- or counterclockwise direction?

I've read this one, but I need more info: rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise? I have a ball. The user is able to drag the ball in any ...
351 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 ...
700 views

### Asteroids Movement

I have been making an asteroids clone, in C#. However, the ship's movement is... not quite right. My plan is this: there is a speed, and two directions, namely the direction the ship is facing (...
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... ...
232 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(...
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 ...
168 views

### Using circles to create a sphere

I've been working on creating spheres in a 3D space recently, and have successfully created cylinders. I've just run into a little problem. For some reason, my "Spheres" end up looking like very thick ...
145 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, ...
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 ...
55 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 ...
61 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) ...
162 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 ...
112 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 {...
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 ...
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 ...
35 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 ...
171 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 ...
275 views

### What is the connection between an isometric angle and scale

I am trying to work out an isometric projection matrix for a custom angle. In the engine I'm using there's a projection matrix defined like so: projection.rotate(45 * (Math.PI / 180) ); scale = 1....
378 views

### getting direction of x and y… north,south,east,west

I have a player in the center of the screen, where I also have my mouse position origin. (0,0) I would like to know the direction of the mouse, imagine splitting the screen with a X, so the top ...
1k views

### Game Institute Math Courses

I'm 21 years old and I suck at math, I mean really bad. I don't have the necessary logic to apply it towards programming. I would like to learn the math and logic of applying it. I found Game ...
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?
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, ...
122 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 ...
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 ...
240 views

### Points around a circumference C#

Im trying to get a list of vectors that go around a circle, but i keep getting the circle to go around several times. I want one circel and the dots to be placed along its circumference. I want the ...
2k views

### Calculate the angle between two 3d vectors: Function always returns 89.1-89.9

I have my own 2d game and I am attempting to calculate the angle between 2 GameObjects. My Problem: My function that is meant to calculate the angle(direction) between 2 Vector3's doesn't appear to ...
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: ...
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 * @...
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 ...
79 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?
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 ...
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" ...
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.