Flip a plotted object horizontally?

2 views (last 30 days)
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.

Accepted Answer

Walter Roberson
Walter Roberson on 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

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!