Slowing left and right velocities...

GnomerGnomer Member Posts: 292
edited March 2012 in Working with GS (Mac)
Hi guys,

I currently have an actor in my scene, you can press up to make it travel forwards relative to the actor. You can press left and right to rotate it in those directions.

Problem is, when you turn and keep on moving forwards, it keeps moving to the side that you turned, how can I prevent this? I tried to slowly decrease the x and y velocities but the problem with that is that it is relative to the scene not actor :(

Basically how to improve steering?

Thanks guys :)

Comments

  • POMPOM Member Posts: 2,599
    Well ... I'm assuming you have 2 booleans "right" and "left" and you accelerate accordingly when they flag to true ..
    So you can make a rule :
    When ALL -
    "Game.right" IS false
    "Game.left" IS false

    Constrain self.linear.velocity.X TO self.linear.velocity.X*0.95

    This will slow your actor down if you don't press the left/right buttons .

    Photobucket Roy
  • GnomerGnomer Member Posts: 292
    I don't have two attributes, it just accelerates forwards so when it rotates, the forwards motion changes.

    It wont be linear x velocity because it might not be facing in that particular direction, so you could be slowing it when it is travelling forwards.

  • CloudsClouds Member Posts: 1,599
    Screen shot of code would help.
  • GnomerGnomer Member Posts: 292
    edited March 2012
    Photobucket

    It's really simple, only problem is that when you turn it just skids and carries on skidding for ever.

    (c is left, b is right.)
  • GnomerGnomer Member Posts: 292
    buuump :D

    anyone got any ideas on how to prevent the character skidding as if it is on ice when I turn?

    Thanks again guys :)
  • MotherHooseMotherHoose Member Posts: 2,456
    @Gnomer … in actor's Physics … increase the Drag

    @};- MH
  • GnomerGnomer Member Posts: 292
    Thanks @motherhoose !

    :)
Sign In or Register to comment.