Actor 2 constraining to Actor 1 but not rotating - Help
I have my main actor 1 which I move and rotate around the screen.
I am constraining actor 2 to actor 1 with a slight offset, this part works great but when I rotate my main actor 2, actor 1 doesn't follow and I am having problems getting this part to work.
I have the following.
Actor 1 (main actor) have 2 real attributes I call TARGET X and TARGET Y
On actor 2 I have:
constrain attribute
self.position X to game.targetX+30 (slight offset)
self.position Y to game.targetY
I just can't work out what sort of rotate attribute I need to add so if follows in the right location when actor 1 rotates.
I am constraining actor 2 to actor 1 with a slight offset, this part works great but when I rotate my main actor 2, actor 1 doesn't follow and I am having problems getting this part to work.
I have the following.
Actor 1 (main actor) have 2 real attributes I call TARGET X and TARGET Y
On actor 2 I have:
constrain attribute
self.position X to game.targetX+30 (slight offset)
self.position Y to game.targetY
I just can't work out what sort of rotate attribute I need to add so if follows in the right location when actor 1 rotates.
Comments
that's just off the top of my head...
it probably requires more math to maintain the angular velocity
ok, try this:
Constrain Attribute
self.Rotation To: vectorToAngle( self.Position.X - game.targetX , self.Position.Y - game.targetY )
That might work...
Otherwise you're going to have to break out those trig books!
Joe
in the expression editor. the little 'e'
Thanks for your help Joe
good luck!
self.Position.X to 30*cos(game.TargetRotation)+game.TargetX
self.Position.Y to 30*sin(game.TargetRotation)+game.TargetY