How to make an object move forward a set distance based on its rotation?
I have a GameObject
pShield
that is a shield that will rotate around my player based on where the position of the mouse is relative to the player.
Currently I have pShield
successfully rotating around from the center of the player to face the mouse cursor. What I want to do next is to move the pShield out from the center of the player to about 3 or 4 units away from the center. If I do this each frame, it'll look exactly how I want it to...
This is what I've tried so far to not only no avail, but also no effect at all!
pShield.transform.Translate(Vector3.forward * 4f, Space.World);
pShield.transform.position += pShield.transform.forward * 4f
Answer by Yuzuke · May 16, 2017 at 06:22 AM
if you are talking about 3D, maybe you wanna open that shield model in sth. like 3DMAX and move the pivot away from the center of the shield model like 3 or 4 units... I suppose.