- Home /
Question by
speed439 · Nov 09, 2017 at 03:47 PM ·
rotationmove an object
move object in a specific angle
all what i want move object in a specific angle as it shown in the pic
i try a lot of things put nothing work my game is 2d
dir.png
(1.7 kB)
Comment
Best Answer
Answer by Kishotta · Nov 09, 2017 at 06:33 PM
If you want to create a Vector2 that is θ degrees from the positive X axis, use the following:
Vector2 VectorFromAngle (float theta) {
return new Vector2 (Mathf.Cos(theta), Mathf.Sin(theta)); // Trig is fun
}
Usage would look something like:
transform.translate (VectorFromAngle (315)); // Or whatever angle. Your image looks like about 315
Your answer
Follow this Question
Related Questions
Can't get ship rotating in place to "launch" in direction it's currently facing 1 Answer
Rotate overtime to match waypoint 1 Answer
Move relative to objects rotation (C#) 1 Answer
How to move an object a fixed distance along one of its axis 1 Answer
move multiple 2d items in a circle around a fixed point 2 Answers