Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / slow turning between 2 waypoints

Author
Message
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 2nd Feb 2004 20:16
look i know i have posted this before, but i cant get an answer, and no i cant find one in an earlier post. My problem is that my ships are using waypoint to navagate. But my current method of having them navagate is to simply point them in the direction of the next waypoit. This looks incredibly unrealistic. i want the ships to turn in an arc untill they are facing the waypoint. does anyone know how to do this!?!??!?!?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Feb 2004 21:43
Work out the angle, then turn a percentage of the angle each cycle until you are facing the new waypoint. If your new angle takes you past, adjust on the last turn.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 2nd Feb 2004 22:30
Hopefully this will help. There is still a slight problem where it may be possible for player to go round in circles round target waypoint if turning angle is not enough. Hopefully you can sort this out fairly simply.



Boo!
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 3rd Feb 2004 00:28
I have a simple, yet effective way of doing this...



Usually, for the turning code I use a "Turn#" Variable and Increase It if it needs to turn right, Decrease it if it needs to turn left. Then I use "Turn Object Right Obj#,Turn#"... This causes swerving, but you can change that by adding a line that says "Turn#=Turn#/1.03"

well... I hope that helps...

Do not thwart the way of the dragon. For thou tasteth like chicken.
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 3rd Feb 2004 00:50
This is what I use:


Why do programmers always mix up Christmas and Halloween?
Because DEC 25 = OCT 31
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Feb 2004 01:43
Quote: "it may be possible for player to go round in circles "


One way to prevent this is to assign a maximum speed to each waypoint, forcing objects to slow down for tighter turns.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 3rd Feb 2004 20:13
ok but how do i calculate how much the ship needs to turn?
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 3rd Feb 2004 21:03 Edited at: 3rd Feb 2004 21:03
you could use the curveangle command for this. just point you ship to the waypoint then get the angles of the ship and return back to the old angles. then all you'd have to do is use the curveangle command to calculate how much you ship has to rotate each loop.



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 4th Feb 2004 20:19
ohh thats good! im goonna use that mussi, thanks!
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 4th Feb 2004 20:31
ughh now im haveing trouble returning it to its original value!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 4th Feb 2004 20:35
dude try a variation of this:



stripped out of a function from something I am working on. This code portion is actually by VanB, so you can thank him.

-RUST-
"What the... Mooooooooooo!"
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 4th Feb 2004 21:05
would this work?

this is a simple test program to ge tthe ship to move between 2, points. But right now it keeps pointiing away from the second point!
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 4th Feb 2004 23:47
Quote: "ughh now im haveing trouble returning it to its original value! "


why? just store the angles before you do any rotating and then point the ship to the waypoint and save the new angles and rotate your object using the old angles. then you'd only have rotate your ship like this every loop: CURVEANGLE(Destination Value, Current Value, Speed Value)



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb

Login to post a reply

Server time is: 2024-09-21 17:52:44
Your offset time is: 2024-09-21 17:52:44