A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.

learn more… | top users | synonyms

4
votes
1answer
67 views

How to prevent jitter amongst near-stationary physics objects?

See image for reference Hi Guys, I have been implementing a custom physics engine, and I'm pretty close to having it working as I would like it. There is a gravitational force, and of course ...
0
votes
1answer
29 views

Java/Libgdx - Finding distances between sprites in an array

i'm new to java and was hoping if anyone can help me out. So my game has meteors which spawns off screen and sometimes as they spawn, they overlap each other which I don't want. I want them to spawn ...
0
votes
2answers
109 views

How does one calculate the surface normal, in 2D collisions?

I have a ball, which should bounce when it collides with a surface. I know the formula for reflections; (v1 - 2(v1 • n)n) However, I cannot obtain the required information. I know: the ball ...
0
votes
1answer
22 views

Align Players Rotation

I'm currently working on rope Swinging. The Rope consists of Physics Constraints/Joints and between them the rope is rendered. I would like align my Character's Pitch to the Rope. I'm horribly bad ...
1
vote
1answer
30 views

Getting player cube to move left or right in relation to camera based on camera's rotation

Right now I'm trying to make the player cube move left, right, up and down in relation to the camera's rotation and position. I figured what I could do is create an empty game object, make the main ...
4
votes
1answer
47 views

What does SlerpUnclamped do?

Unity has a Slerp method: public static Vector3 Slerp(Vector3 a, Vector3 b, float t); Where it returns an interpolated position between a and b by the percentage of t. So if t = 0.5, and a = ...
0
votes
2answers
63 views

How to make a spaceship auto level while in orbit

I’m trying to make a ship auto level so that the belly of the ship stays facing the planet. I found the answer in 2.5D*, but I can’t get it to work in 3D. //world rotation * up Vector3f spatialY = ...
0
votes
1answer
23 views

Three points to normal notation (interpret the math)

From: Euclidian Space: Planes, I see the formula: Convert Three points to normal notation N = (p1-p0) × (p2 - p0) d = -N • p0^2 where: N = normal to plane (not necessarily unit ...
0
votes
1answer
27 views

What are the advantages of using SAT(seperating-axis theorem ) in collision detection?

Lets say i need to check if two AABBs are colliding with each other. I would simply compare their corners. When am i gonna need SAT(heavy vector calculations) to do the same thing?
0
votes
1answer
29 views

Coordinates of the corners of a rectangle bridging two circles

I am implementing a game that involves slingshots and circular objects. I have gotten the basic "geometric" construction down for rendering the slingshot, but I am having trouble implementing this in ...
1
vote
1answer
179 views

Why does a unit vector show direction?

If I have two objects, Person A and Person B, and I want to know if Person B is facing the same direction as Person A; once I have the vectors, how do I use the normalized vector to show direction? ...
0
votes
2answers
66 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 ...
0
votes
2answers
66 views

How to calculate vector of projectile initial velocity

There are point A (origin) and point B (target). And also there is gravity vector G. I need compute initial velocity of projectile (throwing arc trajectory from point A to point B). Also I need to ...
22
votes
3answers
2k views

How can I rotate an object based on another's offset to it?

I have a 3D model of a turret that con rotate around the Y-axis. This turret has a cannon that is significantly off the center of the object. I want the cannon, not the turret, to aim at a specified ...
0
votes
2answers
53 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 ...
0
votes
1answer
38 views

Ball bounce in 3d

I cannot get my bounce equations right. I have 2 spheres, that can colide at any angle. One is forever stationary, other one is moving though the space. I have X,Y,Z speed of the moving ball and a ...
0
votes
2answers
56 views

Rotating Object parallel to other object

I try to rotate objects in the same direction as a reference object. Normaly this would be easy: object1.rotation = reference.rotation But the same rotation can be expressed with different ...
0
votes
0answers
12 views

Calculation of momentum and angular momentum after a kinetic impulse at a certain location

In a space game, how does one calculate the rotation and velocity of a craft, after it got affected by a kinetic impulse. I've drawn a sketch to illustrate my problem. The kinetic impulse could be a ...
5
votes
2answers
97 views

Scrolling background after firing projectile

I have a projectile which I fire using the mouse coords as the direction vector which I scale with a velocity vector and add a gravity vector to complete this simple simulation. I want to scroll the ...
-1
votes
1answer
62 views

Smoothly moving an object sideways by a certain amount when a key is pressed Unity C#

I basically want to have the user press A once without holding it down, to smoothly move the player to the left. I would like to make the player move to the left by -12. So he would end up going from ...
0
votes
0answers
36 views

Calculating Jumps in Unity3D

I'm currently learning Unity, and having a hard time when making a Character jump.So I can jump and move fine, but most of the time is just: Search for tutorial, understand a few things, adapt code ...
0
votes
0answers
21 views

Find pairs of the closest position in list of positions

Given an array of positions, what would be the fastest algorithm for finding pairs that are closer to each other than to any other object?
0
votes
1answer
30 views

How to rotate to look at target

I have found other questions like this, but none seem to quite cover the situation I have. I am using DirectX 11 I have an object that has: Position (vector) Rotation (quaternion) View angle (pitch,...
1
vote
1answer
40 views

Drawing & transforming matrices upwards

I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale. I get my expected results If I draw my objects from my root node in this ...
-1
votes
1answer
33 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 ...
0
votes
1answer
51 views

Clamp point to triangle for sphere collision

I'm having some issues clamping a 3d to barycentric triangle. I've searched for some time now and keep seeing the same results, that (u,v,w) should be clamped between 0 and 1. But when I clamp those ...
-1
votes
2answers
76 views

Inconsistent speed when using Vector2.Lerp

I have tried to build a point and click mechanism in unity using Vector2.Lerp(current_position,new_position,Time.deltatime) But what I observed that the game object is moving at varying speeds ...
2
votes
1answer
63 views

Find the closest point on a ray

I've got a ray defined by P1 and P2, and then a target P3, and I want to find P4. How do I go about this? I've come to understand that I should use vector projection, but I can't get it to work. Any ...
0
votes
1answer
38 views

Roll a 6DOF camera to a plane direction

I've been working on a 6DOF camera that I want to be able to "align" to any walls orientation to make it feel like I'm standing on that wall. I'm thinking it's a simple matter of finding the right ...
0
votes
0answers
17 views

Adjust Object Velocity depending on Rotation

I am building a vehicle handling line in hyperPad, with no luck. I have a "gas pedal", and the vehicle. I can use add, subtract, multiply, divide, mod, get Rotation, get Velocity and set Velocity. ...
3
votes
2answers
237 views

C++ alternative to vector for arbitrary number of objects using pointers

I'm working on a prototype 'life simulation' game which incorporates any number of objects / entities that may exist in the game. Up until this point I had been working with vectors of the objects, ...
2
votes
3answers
96 views

How can I rotate the camera for a player walking around the surface of a sphere? [duplicate]

I'm making a 3D game where the player can walk across the surface of a planet. I am having a problem correctly rotating the camera's frame of reference, so that the camera is oriented correctly ...
1
vote
1answer
43 views

Rotation smoothing with Slerp snaps to center when switching between different destination vectors

I'm making a 3D space shooter in Unity (think Star Fox). The ship, when I move it around the map, should rotate slightly (smoothly) in the direction I'm controlling it. I have smoothness mostly ...
0
votes
1answer
40 views

How to place text centered on the player? XNA

As I can make a text of the size of this, it is centered taking reference of the player? Right now the following happens: I want: code: spriteBatch.DrawString(Font, player.Name, new Vector2(player....
1
vote
1answer
28 views

How to calcolate moving vector of object by its rotation degress in 2d

i have object in game which is rotating when i move my joystick , now i need to calculate its movement vector by its rotation the object always moving forward and controlled by the joystick , the ...
0
votes
0answers
32 views

Keeping track of space objects: enemies, projectiles, players

I have a Vector called spaceObjects of type SpaceObject that contains all types of SpaceObjects: Heros, Projectiles, and Enemies. I've added all these to this one Vector because I'm passing it all ...
1
vote
3answers
74 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 ...
3
votes
1answer
94 views

Garry's Mod gamemode scripting (lua) - How do I tell if an object is inside a hollow cylinder?

I'm fiddling about with gMod trying to make a gamemode where you have to throw a piece of cake into a cylinder that spawns on the map. This is the code I'm using to spawn the cylinder: local ent = ...
0
votes
1answer
67 views

2d animation on html5 canvas using a vector and speed

Im moving a starship from one location to the other. In creating a vector, normalize and magnitude it. Lets assume my vector looks like this Vector x: 156, y: -90, m: 180.0000000546, ...
0
votes
1answer
21 views

Lengthen Line (bidirectional) - crossing zero line

I'm trying to lengthen a line, by a certain amount. I want to apply the modification to both points on the line, expanding it in both directions. without moving it from it's current position (center ...
1
vote
1answer
38 views

Pitch/Yaw in circle causes undesired Tilt [duplicate]

I've made my own Camera object, with a forward vector as well as a up vector. I happen to be programming in Android using OpenGL ES 2.0 but I think this question is relevant to all frameworks, it ...
0
votes
1answer
32 views

MonoGame - scale down a sprite from the middle

I want to animate a texture's scale. First it's scaled up to 10, and then it gradually goes down to 1. However the texture is drawn at Vector2(0, 0) so it doesn't animate as I had imagined it would - ...
1
vote
1answer
139 views

LibGDX: How to make something like vector rotation sensor with accelerometer and compass values?

So I've tried the vector rotation sensor using the Android API and it works perfectly to do what I want, but LibGDX does not support this sensor. I've been searching and it seems like I can do the ...
0
votes
2answers
64 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/...
0
votes
0answers
23 views

Javascript applying thrust to my inertia

I'm using http://www.mathguide.com/lessons2/Vectors.html#combining as a reference. Their magnitude values are too large for my pixels so I'm decreasing by a factor of 100 - so the 30 magnitude becomes ...
1
vote
1answer
54 views

Computing how fast a vector should go toward certain direction

I have two object in space, one has velocity (object A) with fixed magnitude, and one is static (object B). every timestep, I add to object A's velocity a vector which direction is object A to object ...
3
votes
1answer
79 views

Clamp camera view angles relative to moving object

I have a camera attached to an entity that moves in a circular pattern around a fixed center position. I am attempting to clamp the rotation of the camera such that it can only look inward toward the ...
0
votes
1answer
77 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)...
1
vote
2answers
65 views

Move to specified coords - libgdx and java

So I am making my bullets go to a point and travel further. Only its acting really really weird. Its like its thinking that the 0,0 location is at the top left instead of the bottom left. This is the ...
0
votes
1answer
32 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: ...