Based on a single Y rotation (Rot) of an object on the XZ plane that periodically updates its position (Pos) by adding its velocity (Vol), how can I calculate relative velocity?
So I.e. Using Unity's standard vector libraries
Vector2 Pos = Vector2.zero; //(0,0)
Vector2 Vol = Vector2.one; //(1,1)
float Rot = 30; //30 Euler degrees
void Update()
{
Vector2 RelativeVelocity = MethodForCalculations (Vol); //Calculates based on velocity and angle
Pos += RelativeVelocity; //Changes position based on velocity and angle
}
Aucun commentaire:
Enregistrer un commentaire