playMaker

Author Topic: Ship movement  (Read 1914 times)

failtruck

  • Playmaker Newbie
  • *
  • Posts: 6
Ship movement
« on: March 23, 2013, 06:16:49 AM »
Hi there, I've been noodling with playmaker and trying out various bits and bobs to learns the system (come up with idea, then implement, next idea implement) and I've learnt a huge chunk in a short amount of time.  Currently I'm trying out an rts with sail ships, and I can't for the life of me get the movement correct.  I can make object move from one point to another, fire when in range and angle etc, its just I can't get them to move like a ship.  I want each ship to maintain forward momentum, and when the receive a new waypoint to turn in an arc to the new waypoint.  Currently the just turn on the spot.  Any advice on how I should go about this?

KozTheBoss

  • Full Member
  • ***
  • Posts: 150
  • You dont fail unless you give up trying to succeed
    • Pixel Life - portfolio
Re: Ship movement
« Reply #1 on: March 23, 2013, 01:37:11 PM »
not sure if this would work, but how about saving the forward momentum as a var so it will stay on even though you go to a new state, and then use rotate towards action and rotate towards target location over a ceartain amount of time? i can imagine that that would keep it thrusting forward while slowly turning, giving the affect of a slow arc-like turn :)
Remember, you don't fail unless you give up trying to succeed!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Ship movement
« Reply #2 on: March 23, 2013, 01:46:30 PM »
I would use Physics, setup an ActualSpeed variable, link AddForce every frame to it and use a float clamp every frame to set a max value, when it gets to the destination trigger set float to 0 so it resets the force being added and it will use friction drag to slow down. Should feel really floaty after you get the variables tweaked. That is the hard part.

For turning if you are using a RTS click and move style it will probably not be as easy as you would think and there are a lot of different ways to do it. First thing I would try is when you order it to move 1. addforce foward, smooth look at target destination (stored as a vec3 when you clicked) and make the look very slow so it will add force forward and slowly turn to look at the destination and make that wide motion.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D