Face Mouse

flapairflapair Member Posts: 67
edited December 2011 in Working with GS (Mac)
HI everyone i always made the same code to my character so they faced the mouse which is the following:
Constrain Attribute -> self.Rotation (to)-> vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )
It always worked but this time the actor is not rotating is not doing! Does someone know why nothing is happening?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    should be working

    whats the issue its not rotating at all or rotating incorrectly? IF its incorectly rotating are you sure the image you have for the rotation actor is facing right, if its not rotating at all are you sure the rules are in the actor in the scene if its unlocked?




  • flapairflapair Member Posts: 67
    it rotates but only like through -20 until 20 degrees it doesn't change more than this is not like 90 degrees or 180 or 270 degrees wrong it just goes thorugh the rotation of -20 until 20 wherever the mouse is
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    is your camera at 0,0?

    If not you need to change mouseposition to "mouse.positoin + camera.origin" for both the x and y
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    If it is wobbling between -20 and +20 that indicates that 'self.position.X' is not correct. Most likely, it has 'self.position.Y' in there twice.

    Hope this helps!
    RThurman
  • flapairflapair Member Posts: 67
    Thanks everyone it finally worked i did what scitunes said by adding camera.origin now its working well thanks!
  • torogitartorogitar Member Posts: 1
    Thanks everyone it finally worked i did what scitunes said by adding camera.origin now its working well thanks!
    how do you acess the camera.origin on the mac version?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    how do you acess the camera.origin on the mac version?
    Unlock an actor on the scene and you'll see scene attributes among the normal list of attributes when you do a change/constrain behavior. Camera origin will be there.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Wow. Two years old...Sad
Sign In or Register to comment.