- Home /
Calculating a new position based on where another object is facing
I have a character (call it c1) that is able to move to another character's (call it c2) current location. However, I would like for c1 to move about 20 units in front of and to the right of where c2 is located. "front" and "right" are based on where c2 is facing. c2 is an FPC. Anyone know how to translate c2's position in that manner?
Thanks for any help!!
Comment
Best Answer
Answer by Eric5h5 · Mar 19, 2011 at 02:22 AM
Assuming c2 is a Transform:
var c2RelativePosition = c2.position + c2.forward*20.0 + c2.right*20.0;
Your answer
![](https://koobas.hobune.stream/wayback/20220613113633im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Move object A towards object B 2 Answers
Relative Rotation 1 Answer
How to change an objects position and rotation inside a script? 0 Answers
Unable to set Rotation 1 Answer