Rotate an actor and accelerate to the new angle

AssortDisAssortDis Member, PRO Posts: 22

Hi all,

I've been unsuccessfully trying to make an actor that is spawned randomly, rotate to a random angle between 45 to 145 degree and then accelerate/change velocity to its new angle.

Currently I can do the random rotation with this rule:
Rotate to angle: random(45,145)
But the moving afterwards is quite difficult. Thanks for your help in advance.

Comments

  • pHghostpHghost London, UKMember Posts: 2,342
    edited September 2014

    Welcome to the Forums!

    Create a actor attribute (integer) called myAngle.

    Use the Change Attribute action to change self.myAngle to self.rotation

    Then use a Change Attribute action to change self.linearVelocityX to self.myAngle

  • AssortDisAssortDis Member, PRO Posts: 22
    edited September 2014

    @pHghost said:
    Welcome to the Forums!

    Create a actor attribute (integer) called myAngle.
    Use the Change Attribute action to change self.myAngle to self.rotation
    Then use a Change Attribute action to change self.linearVelocityX to self.myAngle

    Hey, nice to be here too.
    Thanks for your help, it works well!

    Although I don't really understand some of the logic behind. Why do I have to change self.linearVelocityX to basically, self.rotation and not self.LinearVelocityY?

  • pHghostpHghost London, UKMember Posts: 2,342

    Can you explain more what you are trying? The way I understood it you wanted the object to start moving at a speed that is equal to its angle. Is that so?

  • pHghostpHghost London, UKMember Posts: 2,342

    If you instead wanted it to rotate randomly and then start moving in the same direction as the rotation, all you need is one behavior: Move.

    There, set the Direction to self.rotation, relative to actor, and set the desired speed.

  • AssortDisAssortDis Member, PRO Posts: 22
    edited September 2014

    @pHghost said:
    Can you explain more what you are trying? The way I understood it you wanted the object to start moving at a speed that is equal to its angle. Is that so?

    Yup, you understood that right and I got the problem solved already thanks to your first post. Now I'm using change velocity behavior to move to the new direction.

    Sorry for not being clear in my second post and you can disregard my question there.

Sign In or Register to comment.