How to make a smooth corner turn

  • AllanR

    Thanks a lot,

    And how will I make the set position smooth since I want to do this for the movement of Car AI that will move according to the directioner sprite angle . And change its animation when the angle is changed.

    And how can I make the movement to take reverse for e.g. the car to take reverse and change the path.

    Kind regards

  • Sangeeth777

    To make it turn like a vehicle required a completely different approach because it was too hard to place the directioner/trigger objects. Knowing the angle to the next point didn't work because a vehicle requires space to turn around - and the amount of space varies depending on the approaching angle and where the next point is in relation to the current point.

    I tried path finding (like dop suggested) but couldn't get that looking accurate either - when it rotated it didn't look like a truck turning (looked like a tank).

    so I changed the trigger objects to know which trigger is the next one to head to, and then the patrol truck keeps turning towards the next point until it is lined up with it (using a pointer object to tell it how far off the angle is and limiting how much it can turn each tick).

    this method works really well and looks like a vehicle to me. I wasn't sure what you meant by changing the animation when the angle changes - do you mean some kind of 3d or 2.5d effect? And I also didn't understand what you meant by reverse and change path. do you mean coming to a stop, backing up and turning down a different road? That is a much more complicated AI, and you would have to define the rules of your world to know what would make the vehicle stop and choose a new route. My method is still using bullet behavior - and bullets don't go backwards...

    https://www.rieperts.com/games/forum/patrolvehicle.capx

  • Guys, check out Rojo's examples in this post, they are really cool:

    construct.net/en/forum/construct-2/general-discussion-17/follow-path-behavior-42924/page-3

    .

    Also, there is a Spline behavior, which allows to follow the path and change the angle smoothly.

    construct.net/en/make-games/addons/198/spline-movement-c3-runtime

    Demo:

    rexrainbow.github.io/C2Demo/Spline%20-%20path/index.html

  • dop2000

    awesome stuff! I have a whole library of ROJOhound routines! and just added that one...

    although the line followers don't turn like a vehicle. In that last sample I was also trying to leave the door open to additional AI features - like conditional branching at a way point, or stopping. And possibly obstacle avoidance (if the truck in front of you gets blown up).

  • Thanks a lot of good examples.

  • AllanR dop2000

    Thanks alot and sorry for the late reply.

    and about the animation change (i.e. when the truck is moving in the right direction then it will play right animation, and when it moves in the left direction it will play left animation and when it moves forward it will play forward animation (i.e. when angle = 0 degree (play right animation), 180 degree (play left animation), 270 or 90 degree (play forward animation) how would it get this animation to work.

    And about the reverse and change path. i mean to stop the truck when the road is blocked and backing up the truck and turning down on a different road.

    Can you please help me out on this.

    Kind Regards

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AllanR dop2000

    hey,

    can you please help me how would i change the animation of the truck with respect to the angle, suppose the convoy is moving straight and the angle of convoy =90 or 270 then play "straight" animation, or it is moving in counter-clockwise direction then play "side" animation and set the object to not flipped, or it is moving in clockwise direction then play "Side " animation and set the object to flipped.

    i am attaching the capx file below.

    drive.google.com/file/d/1on2jNG2o-1QCShyTrZPG5zRiWSUmW5GD/view

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