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 / I followed the rules, I looked through the forums first, still need help

Author
Message
cypher
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 5th Dec 2002 08:16
I am still without my DBPro shipment. I am trying to figure out how to get an object to follow a path.

I'm not expecting someone to write the code, but a push in the right direction sure would be great .

tx
cypher
Necrym
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: Australia
Posted: 5th Dec 2002 09:40
What is it your actually trying to do exactly.
A path is just a movement between coordinates
What i do is get the xyz cords on screen and
write them to a file then read in the file to a variable and then move the object to the new cordinates.

Watch the bouncing cursor - now in 3d
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 5th Dec 2002 09:42
create a cube that will be the dummy camera object
object 1

create as many waypoint cubes as you like

10 - 20

10 objects

make the dummycam cube start at the first waypoint cube.
point it towards the 2nd one.
make it move or update its position.

use a distance function or a collision command to detect when it should change to the next waypoint cube.

make sure u loop the program around the waypoints

eg:
if (your Collision method = 1) and i <=20
i = 10
endif





yarbles showed me the curvevalue can be used to create a smooth angle turn instead of hard turns from waypoint to waypoint.




hide the cubes in the final usage but have them visible so u can debug it.

cypher
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 5th Dec 2002 19:11
Necrym: I am making a very small race game. I want to have one opponent cruise the track in competition with my car...nothing complex, just path following.

indi: tx, I'll use the process you stated and see what I end up with. If I figure this out I'll post the code for all to have.

tx guys
cypher

Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 6th Dec 2002 07:35
The simplest way to do this, is create an array of "way points" on your track. Get the X & Z positions at every bend/turn in the track. (If it's a 3D course, then you'll need the Y position too)
When the "AI" car gets within 1 unit of the X & Z position, point it at the next spot in the array. When it's at the last spot in the array, wrap back the the first spot in the array.

You can add more into it, like making the AI car turn to point at the next spot or adding obstacles for it to avoid. This is just a very simple way to make an AI car go around a track.

-Kensupen
Necrym
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: Australia
Posted: 8th Dec 2002 01:37
OK both indi and kensupen have given what you need. What i do is create your map then get the xyz position on screen of yourself. Then walk/drive the map and take note or write the xyz positions to an array/file of the waypoints. then use this file later as the opponents car objects movements. You could randomize some aspects of the movements and incorporate ai for the opponents movements later.

Watch the bouncing cursor - now in 3d
Stevo
22
Years of Service
User Offline
Joined: 4th Oct 2002
Location:
Posted: 8th Dec 2002 04:09
I tried to do something like that, I wanted to get two wheels to go around together (the front wheels of a car), I did manage it a bit by linking the position of the second wheel to the first, pos2#=pos1#+50etc, that worked but then when you went around corners the second wheel would turn around inside the first! I couldn't find away to make the second wheel always be in the same position relative to the first?

The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 11th Dec 2002 03:49
ok, here's a shot in the dark. I used this in a program of mine for a virtual cockpit: If you want the left wheel to rotate its position around the right one, then you position the left on the right and make their directions the same, then rotate the left one 90 degrees to the left, move the wheel forward the width of the wheel, then turn it back 90 to the right so it is back in the same direction as the right wheel. It sounds like a lot of work, but if you write it once as a function for two objects, you can reuse it for any two objects you want.

PS make sure AutoSync is off or else you'll see some rather funny things with your wheels

1.00 GHZ processor, 256 MB RAM, GeForce 3 64MB, SB Live!, 8 cans of soda per day

Login to post a reply

Server time is: 2024-11-23 18:06:29
Your offset time is: 2024-11-23 18:06:29