Make an object face the way its moving?

GameDevGameDev Member Posts: 14
edited November -1 in Working with GS (Mac)
Hey Again,

im working on a project, where meteors fling to towards the earth and you gotta block them, etc.

http://farm5.static.flickr.com/4054/4707701927_fda1ec1242_b.jpg

How do i get the meteor to face the earth when its flying, and then face the away when its flying away from the earth?

Comments

  • expired_012expired_012 Member Posts: 1,802
    Make an extra copy of your image, except this one flip it horizontally. Then when the object moves the other way, change image to whatever that new image is.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    If they are circular, you can also try rotate to angle and use the x and y of the earth.
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    Constrain attribute
    self.rotation
    to:

    vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y )

    A good behavior for having any actor rotate smoothly towards its direction of movement.
  • RHRH Member Posts: 1,079
    I find that I have to add -90 after vectorToAngle( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y ) that. It depends on which way the image for your actor is facing.
  • GameDevGameDev Member Posts: 14
    When i use the constrain attribute, whenever i add that with an acceleration property, my whole scene just disappears when i test it. I remove the acceleration property, everything comes back, but the meteor doesn't move. (Of course)

    Bug?
  • RHRH Member Posts: 1,079
    What are you constraining?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    If your whole scene disappears, it is because of a syntax error. Check your parentheses, and make sure are choosing all attributes from the dropdown menu and that you arent just typing them in.
Sign In or Register to comment.