Jump to content
johnnyboy

move object through curve smoothly?

Recommended Posts

Edit: This is mostly solved by immediately executing another setVelocityModelSpace using  velocityModelSpace value saved just prior to doing a setDir.  Turns still a little awkward but good enough.  Soon I will release a script allowing you to get an AI boat to go ANYWHERE using waypoints (awesome for the Mekong Delta!).

 

I'm trying to write a script that allows boats to follow waypoints exactly in complex areas normal boat AI NOT will follow (i.e., new Prairie Fire Mekong Delta for example).  I can script a boat moving in a straight line perfectly from one waypoint to another using setVelocityModelSpace.  The problem I have is turning boat smoothly in direction to next waypoint.  I've tried using loops or eachFrame to turn boat towards next waypoint position using setDir and setVectorDir.  This works, but it stops the boat's forward movement to make the slow clean rotation towards the next waypoint position.  This looks dumb that a boat has to stop and make a turn.

 

How do I make a bot do a smooth turn WHILE still moving forward at the same time?  

 

I've spent many hours trying to get setVelocityTransformation to work for this, but no luck (probably because I do not understand vectors).

 

So how do I move an object forward at speed (without stopping!) and turn the object toward new destination (to follow a curve I guess), until object is aligned toward destination (at which point it just does straight movement toward destination)?

 

Please advise.

 

Sincerely,

Your math and physics challenged friend,

Johnnyboy

  • Like 1

Share this post


Link to post
Share on other sites

AI must drive slowly with boats (limitSpeed)

you can help on waypoint by command like addTorque...  something like:   boat addTorque [0,0,10000];

you must test your path again and again.... in careless mode for the driver.

Share this post


Link to post
Share on other sites
5 hours ago, pierremgi said:

AI must drive slowly with boats (limitSpeed)

you can help on waypoint by command like addTorque...  something like:   boat addTorque [0,0,10000];

you must test your path again and again.... in careless mode for the driver.

Thanks Pierre.  But there are actual places in maps where they won't drive.  On Tanoa there is the one nice little dock by a road bridge that has a narrow mangrove swamp/river to get out to ocean.  Player can drive a boat down this river.  AI cannot no matter how well the way points are placed.  This is the problem I am trying to solve.  If there is no obstruction between two waypoint positions, I want to force the boat there (at any speed!). The waypoints will be hand placed in editor (i.e., I'm not trying to calculate a water path).  As I saw you say somewhere else, BI hates the Navy!  Hahaha.

 

@Rimsiakas:  Thanks, I know about unitCapture.  I used unitCapture in my Property of Mabunga mission to force units to go up the canal into the swamp area in Altis.  But this is very time consuming to record lots of paths, then save the path files, and add scripts and triggers to run the boats thru the paths.  Also thanks for the Key Frame Animation link.  I did not know of this capability.  That is realy cool, but once again looks way to complex for creating simple boat paths.

 

My goal:  Mission maker places AI driven boat in editor and places Move waypoints.  Each move waypoint in sequence is visible (and therefore navigable) to the next waypoint.  Editor places call to my script in first move waypoint.  At runtime, the script will move the boat through each way point.  I have this working right now, but the problem is the boat slows drasticly or stops at each waypoint to make the turn to the next waypoint.  I need code to make a smooth turn WHILE still moving forward.  I believe setVelocityTransformation will do this, but I don't know how to use it.

Share this post


Link to post
Share on other sites

I solved this (at least improved it alot).  Will be releasing a script in about a week or so.

Share this post


Link to post
Share on other sites

Depending on what boat your using in your mission, small config tweaks can make boats much more agile on the water, smoother movement etc....I have a rescue boat that turns on a sixpence compared to the vanilla version.

Obviously no good for a scripted mission your building, but just saying there are other ways to make water navigation "easier"

 

Share this post


Link to post
Share on other sites
8 minutes ago, EO said:

Depending on what boat your using in your mission, small config tweaks can make boats much more agile on the water, smoother movement etc....I have a rescue boat that turns on a sixpence compared to the vanilla version.

Obviously no good for a scripted mission your building, but just saying there are other ways to make water navigation "easier"

 

Thanks EO.  The problem I'm solving is not the agility of the boats, but the retardedness of AI boat drivers.  They simply won't navigate narrow rivers very far before getting confused or stuck on shore.  Probably a pathfinding issue.  It would be nice if they just followed their waypoints, instead of using their "brain" to determine how to get to next waypoint.  So my script eliminates pathfinding and moves them straight from waypoint to waypoint with a hopefully semi-smooth turn towards the next waypoint.  Demo coming soon!

  • Like 1

Share this post


Link to post
Share on other sites
Just now, johnnyboy said:

Thanks EO.  The problem I'm solving is not the agility of the boats, but the retardedness of AI boat drivers.  They simply won't navigate narrow rivers very far before getting confused or stuck on shore.  Probably a pathfinding issue.  It would be nice if they just followed their waypoints, instead of using their "brain" to determine how to get to next waypoint.  So my script eliminates pathfinding and moves them straight from waypoint to waypoint with a hopefully semi-smooth turn towards the next waypoint.  Demo coming soon!

 

Waypoints or not, if your AI can't sail on narrow, and shallow, waters,... it falls into unitReady and nothing more occurs.

  • Like 1

Share this post


Link to post
Share on other sites

If terrain makers could make an underwater "road" network that only boats could follow...

  • Like 2

Share this post


Link to post
Share on other sites
53 minutes ago, pierremgi said:

Waypoints or not, if your AI can't sail on narrow, and shallow, waters,... it falls into unitReady and nothing more occurs.

Fear not mon ami marin, JBOY AI sailors shall sail on narrow and shallow waters...and FIGHT while they do it!  😉 Coming soon....

52 minutes ago, EO said:

If terrain makers could make an underwater "road" network that only boats could follow...

Exactlioto Quasimoto!

  • Like 2

Share this post


Link to post
Share on other sites
35 minutes ago, johnnyboy said:

Fear not mon ami marin, JBOY AI sailors shall sail on narrow and shallow waters...and FIGHT while they do it!  

When seagulls are feet dry, it's time to veer!

  • Haha 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×