Constrain Position to Rotation
Hi everyone!
I have a problem with one thing:
I have two actors in the scene, one of them is rotatable by player (so player can touch it and rotate). It constrains game attribute to actor's rotation.
The second actor is something like indicator on the chart (there's a vertical axis, and the actor is moving on this axis to show the rotation of the main actor).
This actor have a rule:
Constrain Attribute self.position.Y to mentioned above game attribute.
AND
if self.position.Y is bigger than 240.5
then change self.position.Y to 240
AND
if self.position.Y is smaller than 109.5
then change self.position.Y to 110
As you can imagine - it's not working. The indicator actor is just jumping between 240 and 110 (obviously because the game attribute has much bigger values).
Anyone has any idea how to solve it, and make the indicator actor move in Y axis, with rotation of the main actor, but only in specified period? So, when rotation of the main actor is 180, then the indicator actor is in the middle (160 on Y axis), when rotation of the main actor is 359, then the indicator actor is at the bottom etc.? But it has to move instantly with the main actor.
Thank you for your help!
I have a problem with one thing:
I have two actors in the scene, one of them is rotatable by player (so player can touch it and rotate). It constrains game attribute to actor's rotation.
The second actor is something like indicator on the chart (there's a vertical axis, and the actor is moving on this axis to show the rotation of the main actor).
This actor have a rule:
Constrain Attribute self.position.Y to mentioned above game attribute.
AND
if self.position.Y is bigger than 240.5
then change self.position.Y to 240
AND
if self.position.Y is smaller than 109.5
then change self.position.Y to 110
As you can imagine - it's not working. The indicator actor is just jumping between 240 and 110 (obviously because the game attribute has much bigger values).
Anyone has any idea how to solve it, and make the indicator actor move in Y axis, with rotation of the main actor, but only in specified period? So, when rotation of the main actor is 180, then the indicator actor is in the middle (160 on Y axis), when rotation of the main actor is 359, then the indicator actor is at the bottom etc.? But it has to move instantly with the main actor.
Thank you for your help!
Comments
Here to save you again
Remember a constrain is doing a change attribute every frame, so you can't change attribute because in a 10 frame period of your attribute equalling
(Constrained To One)
1
1
1
1
1
4 (Change Attribute)
1 (Constrained Back Within Only One Frame, Your Change Attribute Is Not Noticeable)
1
1
1
What you must do, is constrain with min & max functions.
I don't use these much but I am pretty sure it's gotta be something like
Constrain self.position.y to max(110,min(240,game.rotationAttributeUWereTalkingAbout))
Matt
(Rules from indicator):
If game.XXX is 45
Interpolate self.Position.Y to 207
If game.XXX is 0
Interpolate self.Position.Y to 175
If game.XXX is 290
Interpolate self.Position.Y to 110
Not as perfect as I wish, but it works :P
Constrain Attribute: self.size.height To:130-(game.myRotationAttribute*.361111)
Constrain Attribute: self.position.Y To: 110+(self.Size.Height / 2)
You would change "myRotationAttribute" to whatever you called it in your game.