Turret Behaviour - Set max rotation angle

0 favourites
  • 5 posts
From the Asset Store
Support AdType ( AppOpenAd, Banner Ad, Interstitial Ad Rewarded Ad, MREC Ad) support c3 build service
  • Hi

    does anyone know if it's possible to set the max rotation angle on a turret?

    I'm using the turret behaviour for a weapon that sits on the floor. If the target is also on the floor the weapons angles itself into the floor slightly, looking weird.

    There's physics in this game, and adding physics to the weapon did not help as the rotation point changed to the middle of the weapon sprite.

    I've attached an image showing the issue, any help appreciated.

    Thanks.

    [attachment=0:2pou0qqm][/attachment:2pou0qqm]

  • Check the example EgoAnt posted in this other topic:

    He has 2 turrets, each with a different allowed angle of rotation.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for pointing me to that. It's a good example of setting a rotation value for a sprite, but it doesn't use the turret behaviour.

    I want to keep my turrets with the turret behaviour if possible.

    Thanks.

  • Hi,

    Try this:

    1. Fix your nitial turret angle, suppose it is initAngle = x

    2. Fix the Min & Max angles of Turret, suppose are: MinAngle, MaxAngle

    Goto eventsheet and add this event:

    EVENT:

    yourTurret ..Is between MinAngle and MaxAngle degrees

    ACTION:

    yourTurret..Set angle to initAngle degrees.

    let me know the result?

  • Manarsoft

    many thanks for the help. I've done as you suggested (or as close as I can work out) and using regular Set Angle outside of the physics group does indeed set the turret angle to whatever I tell it. However it's an instant movement of the angle so it doesn't look great.

    So I changed Set Angle to Rotate Towards Angle, and that basically does the same.

    I've also tried unacquiring the the target too, to stop the tracking as soon as it sees it again while rotating it away from the target, still no luck.

    If you have the time, I've attached my capx.

    Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)