i want to move object to it’s rotation direction like if object is rotate right side then its move in right side , if object is rotate left side then its move in left side, if object is rotate forward side then its move in forward side,if object is rotate backward side then its move in backward side. and also add force to that direction.(like angry bird game bird is going to up and then down angry bird is 2d game but i have 3d (like flyboard)).so please give me some ideas for that.
First of all, we would like to advise you to set the velocity of an object at first. If you are using 3D space - declare a Vector3 variable which will be your vector of movement.
Vector3 velocity = transform.forward; //Example velocity vector
Next, set a normalized vector of velocity to see the direction vector of length equal to 1. Just in case.
Vector3 direction = velocity.normalized;
Finally, for setting rotation of an object, use a transform.rotation and set it to Quaternion.LookRotation(direction);
transform.rotation = Quaternion.LookRotation(direction);
You can find a full example at: Unity - Scripting API: Quaternion.LookRotation