Effacer les filtres
Effacer les filtres

Flip a plotted object horizontally?

2 vues (au cours des 30 derniers jours)
Jeff Smith
Jeff Smith le 25 Mar 2018
So I'm plotting a moving object that basically moves like the old DVD "away" loading screen. The object basically bounces around the plane, but without exceeding the limits I've set. (-15 to 15 in the x and y direction). I'm basically trying to figure out how to make the object flip horizontally so that the nose of the object is actually going in the direction of the object. How would I go about this?
BTW I'm using a for loop to move the object along the graph.
If you have any questions or need any of my code, I'll post it.
thanks.

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Mar 2018
Suppose you define the object so that the nose is at the left, with the resting value being x = 0, y = 0. Then as it moves from right to left, adjust the graphic object's X and Y coordinates as
object.XData = nose_x + model_x_coordinates;
object.YData = nose_y + mode_y_coordinates;
and to move towards the right,
object.XData = nose_x - model_x_coordinates;
object.YData = nose_y + model_y_coordinates; %because you do not flip it upside down when it moves to the right

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by