toggle menu
Categories
Discussions
Dashboard
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Dashboard
Sign In
·
Register
×
Home
›
GameSalad 101
›
Working with GS (Mac)
Constrain rotation problem
diegocs
Member
Posts:
531
April 2012
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
mynameisace
Hull, UK
Member
Posts:
2,484
April 2012
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
diegocs
Member
Posts:
531
April 2012
yes, but how can i make it only be contained when moving?
JohnPapiomitis
Member
Posts:
6,256
April 2012
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
mynameisace
Hull, UK
Member
Posts:
2,484
April 2012
Is your Constrain Attribute within the Move rules or just by itself?
Ace
diegocs
Member
Posts:
531
April 2012
by itself, its a character i move with a joystick
john. when placed it inside a rule it still didn't work
JohnPapiomitis
Member
Posts:
6,256
April 2012
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.
JohnPapiomitis
Member
Posts:
6,256
April 2012
Are you using the cross platform control template with the joystick from gamesalad?
JohnPapiomitis
Member
Posts:
6,256
April 2012
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
diegocs
Member
Posts:
531
April 2012
ok, i'll try that later, hope it works, thanks john
JohnPapiomitis
Member
Posts:
6,256
April 2012
No problem, heres the joystick template with it working
http://www.mediafire.com/?x0e7kv1qg1f8k0p
cheers
diegocs
Member
Posts:
531
April 2012
it worked perfectly!!!!, thanks
Sign In
or
Register
to comment.
Answers
Ace
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
Ace
john. when placed it inside a rule it still didn't work
Give me a minute.
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
http://www.mediafire.com/?x0e7kv1qg1f8k0p
cheers