Constrain rotation problem

diegocsdiegocs Member Posts: 531
edited April 2012 in Working with GS (Mac)
I have a character that move around the screen and its rotation is contained to the direction it is moving to, but when it stops moving it changes its rotation back to "0" degrees. how can i fix that?

Answers

  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    edited April 2012
    I'm guessing that the actor is still constraining, so if the direction is 0, then it's constraining the rotation to 0

    Ace
  • diegocsdiegocs Member Posts: 531
    yes, but how can i make it only be contained when moving?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited April 2012
    OK so im assuming you have this:

    constrain rotation to vectorToAngle(self.motion.linear.velocity.x,self.motion.linear.velocity.y)

    So try this

    EDIT(over complicated my first answer):

    Just put the constrain for the rotation in a rule when self motion linear velocity does not equal 0
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Is your Constrain Attribute within the Move rules or just by itself?

    Ace
  • diegocsdiegocs Member Posts: 531
    by itself, its a character i move with a joystick
    john. when placed it inside a rule it still didn't work
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited April 2012
    Yeah thats because your using the joystick and not rotation constrain i thought you were using the i posted above.

    Give me a minute.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Are you using the cross platform control template with the joystick from gamesalad?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited April 2012
    OK so im just gonna assume your using the cross platform template.

    First off make a new real attribute called newRotation

    Now at the top youll see the rule when attribute stick1active=true
    -constrain self rotation to angle 1

    Inside that same rule put a constrain behavior in constrain newRotation to angle1

    Now make a rule when attribute stick1active is false
    -change attribute self rotation to newRotation
  • diegocsdiegocs Member Posts: 531
    ok, i'll try that later, hope it works, thanks john
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    No problem, heres the joystick template with it working

    http://www.mediafire.com/?x0e7kv1qg1f8k0p

    cheers
  • diegocsdiegocs Member Posts: 531
    it worked perfectly!!!!, thanks
Sign In or Register to comment.