Questions tagged [direction]
The direction tag has no usage guidance.
58
questions
0
votes
0
answers
70
views
Trying to get a Character to face the direction based keys pressed left or right instantly
I finished up my movement script which is finally working fantastically. The only issue I am having is getting the character to face the direction when I press either left or right on the keyboard. ...
0
votes
1
answer
25
views
Changing one axis to another
Apologies for the bad title -- I have no idea how to explain this problem succinctly.
I have two 3D vectors. One is the player's movement direction, and the other is the direction towards a wall they ...
0
votes
0
answers
49
views
Which is the best way to get the orientation angle for each direction (Forward, Right, Left, Backward)
I'm running into an issue for a while.
The best way to find the orientation angle between 4 directions in a strafe locomotion mode.
The character can move around in 4 directions. Having a velocity ...
0
votes
0
answers
32
views
Player can only dash towards to the top right, but can't in any other direction?
I have a dash mechanic, but it only seems to be working when the player is going up, down, left, right, or to diagonally to the upper right. It won't work diagonally in any other directions, and I can'...
0
votes
2
answers
958
views
How to check if two normals/directions "look at" each other?
I need to flip polygons in my application. How do I determine if two vectors face each other, like in the second image below? Note that the origin of the vectors is also important, in addition to the ...
2
votes
0
answers
115
views
Gerstner/Sinusoidal wave directional rotation (flow) in regards to ocean currents/trade winds
I'm trying to create an ocean simulation using Gerstner waves based on the GPU Gems: Effective Water Simulation from Physical Models. So far I've completed the directional wave functionality and ...
0
votes
1
answer
71
views
Enemy gun won't aim properly when collision line is flipped | Game maker studio
When the enemy move's to the right their gun faces right. When they move left the gun will face left as it should. When the player collides with the enemy collision line on the right side, the enemy ...
1
vote
1
answer
46
views
Rotate Sprite in direction it is moving while beeing dragged
I am working on a 2D topdown game where you have cars you can drag around. you can touch any given car and move it around.
This kind of works but when I drag a curve the sprit of the car does not turn ...
1
vote
1
answer
1k
views
Raycast wrong direction
I use Physics.Raycast and transform.forward to shoot a ray in front of my gameobject, but the ray gets cast downwards instead.
<...
1
vote
1
answer
317
views
How to mirror a vector through some other vector?
I have a player's direction (playerDirection).
I want to fire two bullets, one rotated by -30f, and one by 30f, so it looks like this:
Blue line is the ...
0
votes
1
answer
230
views
Unity3d: Position a gameobject such that its forms a right angled triangle with other two gameobjects
How do I position C gameObject such that it forms a right angled triangle with A and B. I tried to use ...
0
votes
1
answer
248
views
Unity3d: Find which gameObject is in front
I have two gameObjects A and B. They are rotated at <...
1
vote
2
answers
243
views
How to decrease the size of a distance?
I made a code for the character to be teleported to the place where the mouse cursor is, if the distance is less than or equal to 350.
Blueprint:
I happen to wish that if the distance were greater, ...
0
votes
1
answer
56
views
Movement velocity relative to a static object (Vector Maths)
I have a static object. I have a moving player.
If the player is moving directly towards the object then I want to return the value of 1.
If the player is moving directly away from the the object ...
0
votes
1
answer
392
views
How to Calculate Caridnal Direction from Unit Vector
I have unit Vector of acceleration in local space of object.
Now I want to calculate Cardinal Direction from (North, East, South, West).
So Far I tried to:
...
1
vote
0
answers
310
views
How do I calculate a point between two points with a given distance percentage? [duplicate]
I've made a simple drawing:
The distance between these two points is calculated with a simple formula:
Which gives: 5,38
I need to calculate the green point's coordinates, which is set at 80% ...
0
votes
1
answer
151
views
Bullet direction incorrect around sphere
Here is a little background on how my game objects are set up, and how the rotations and firing bullets work. I am working on this game in Unity.
I have two game objects that orbit a sphere (for ...
0
votes
1
answer
310
views
Make object face another object on a sphere
I have a game I'm working on in Unity where there are two objects on a sphere at random locations (and random rotations). I want one of the objects to always rotate so that if it were to fire a bullet ...
0
votes
1
answer
1k
views
Create rotation in random direction from existing rotation
I am working on a game in Unity, and I currently have a game object (object A) located at the origin. I have a child of this game object (object B), that is 10 units back on the z-axis. When I rotate ...
2
votes
2
answers
6k
views
Random Direction Vector Relative To Current Direction
I have a 2D vector where the x and y values are randomly generated using a range between -1 and 1 respectively. I use this as the direction to move an object in which works great.
...
0
votes
1
answer
193
views
Calculating correct normal direction from multi-variable function
I am working with a plane model which I am offsetting the vertices on the up axis to look like waves by using the function:
Sin(vertex.x * frequency) * amplitude + Cos(vertex.y * frequency) * ...
1
vote
1
answer
308
views
Direction between objects (shortest distance around sphere)
I have two objects rotating around a sphere. One is controlled by the user (object A), another is simulating a user but controlled by the computer (object B). At random intervals of time I'd like ...
1
vote
1
answer
202
views
Why is there a discrepancy between these two transform.up vectors?
I was trying to implement a feature which required transform.up, the result didn't match the green axis gizmo displayed in the editor so I assumed it was being put ...
1
vote
2
answers
4k
views
How to rotate a local position offset based on a direction vector?
I'm trying to fire three raycasts in the direction of movement, from offset starting points. I'm having trouble calculating the start positions of the rays based on the direction.
As you can see in ...
1
vote
1
answer
1k
views
Get GameObject which instantiated me in Unity
How can I get a GameObject from another GameObject? If I know, that the GameObject I want to get instantiated(using function Instantite()) the GameObject from which I want to get it.
If there is no ...
3
votes
1
answer
294
views
What direction does directional audio come from for a 2D view?
In a 3D game, it makes sense that stereo balance is based on the angle between your camera direction and the directionto the audio source.
Is 2D audio just "fudge the left-right balance until it ...
1
vote
1
answer
5k
views
Flip x when direction of the movement changed in Unity
What is the easiest and the most efficient way to flip x of the SpriteRenderer when direction of the movement changed in Unity?
I use ...
-1
votes
2
answers
219
views
Movement based on direction of car?
I'm currently making a simple racing game in libGDX. I am stuck on figuring out how to move my car object based on its direction. So far I have a class PlayerCar.java as shown below:
...
1
vote
0
answers
966
views
How can I add two Vector3 directions together?
I have a direction to my target object, which is in a Vector3 format. I want cast a number of rays, as offsets from this initial direction.
X is the object. D is the direction the player needs to ...
3
votes
1
answer
1k
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
2
answers
619
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
1
answer
2k
views
How to align a hint arrow to point along a path?
I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of <...
0
votes
2
answers
3k
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 ...
0
votes
3
answers
92
views
Velocity Relative To A Vector
So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the ...
1
vote
0
answers
747
views
Why do characters only move in 4/8 directions in top games? [closed]
In many top down games, like Zelda (4 directions)
There are only 4 or 8 possible directions.
Why is this? Is it a design choice or a technology limitation? I can't think of any reason that even ...
4
votes
2
answers
3k
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:
...
2
votes
1
answer
168
views
Collision resolution when moving in two directions
I am making a bomberman clone and I'm having problems regarding moving on both x and y axis (pressing down+left, down+right, up+left). Here is a video to demonstrate the problem. I use Tiled for the ...
9
votes
1
answer
363
views
2D Physics: storing previous position vs storing velocity
I saw a number of 2d game tutorials and books where previous position of an object was stored in state instead of velocity vector. Velocity is then calculated each frame as a difference between ...
1
vote
1
answer
294
views
How to make an enemy projectile head to the player's position with constant speed
How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do ...
4
votes
1
answer
19k
views
How to get direction and velocity of movement of an object dragged with the mouse in Unty (C#)
I have an object that is dragged by the mouse (X and Z positions) over a table, with the following simple code:
...
1
vote
2
answers
5k
views
How to know from which direction there is a collision with an object? In Unity C#
In the game, there is a ball, and moving objects that can hit it. I want the ball to move when an object hits it. But the ball should move to the right direction, the one which the collision was from. ...
-2
votes
2
answers
819
views
In XNA, how do I make a sprite move towards another?
I am making a shoot-em-up with a player-controlled sprite with a gun:
I have most of the game working, but I have gotten to the point where I need to load in the enemy characters and make them move ...
0
votes
2
answers
2k
views
Collision Direction Detection
I'm making an RPG game where players and enemies can collide with walls.
Right now it pushes the player off the wall when he tries to 'go through' it.
However, I detect which way he should be pushed ...
8
votes
2
answers
9k
views
How can I draw a line of certain length and direction?
I want to create a line of certain length and direction.
What I mean by this is drawing a line from Point A to Point B.
Normally in Unity C# to draw a line from Point A to Point B is simply:
...
2
votes
1
answer
106
views
How can I move an object in a direction other than the ordinals?
I want to move a game object from its current position to the mouse position, but my current code only ever moves in one of the eight ordinal directions. In other words, I want it to move along the ...
-4
votes
1
answer
70
views
How can I modify this projectile class to support movement in an arbitrary direction?
Hi I have the following class which Updates and Draws a projectile:
...
0
votes
1
answer
7k
views
Unity - Invert Movement Direction
I am currently developing a 2,5D Sidescroller in Unity (just starting to get to know it).
Right now I added a turn-script to have my character face the appropriate direction of movement, though ...
0
votes
3
answers
2k
views
How can I calculate force and acceleration?
I have problem of calculating the movement of the object.
At the moment, I have a vectors calculated from the center of the screen minus the position of the object.
...
3
votes
4
answers
2k
views
Calculate turn rate between xy and target xy on a moving sprite with variable speed
My First question on here so be kind...
I am writing an aerodrome simulator in as2, I need to calculate a turn rate between 2 points so that the aircraft turns nicely. I have tried a few things but ...
3
votes
1
answer
928
views
How do I detect a tile map collision's direction? [duplicate]
I'm implementing collision detection with the map for my platformer. I have a method that generates a polygon on every tile and checks if the player hits it -- that's all fine. The problem is that ...