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 / Moving an object to destination

Author
Message
GALACTUS
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 4th Jul 2005 14:32
How can I move an object to a destination? For example, if the destination I want to move the object is on the second floor in a particular room of a house, how would I do this? There wouldn't happen to be a command that could take care of this would there?

Hey!!
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 4th Jul 2005 18:25
DB and Other Questions,

Are you wanting the object to translate(instantaneously be positioned from one place to the other, without time), or to move, over time, to this new destination? I will exaplain either way to you, once you answer this question.


+NanoBrain+
GALACTUS
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 5th Jul 2005 03:16
Nano,

I want to move the object over a period of time, like a man walking to that destination.

Thanks,

DB&OQ

Hey!!
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 5th Jul 2005 07:08
DB and Other Questions,

Use a series of waypoints to accomplish this. A waypoint is exactly that, a point within space, 3D or 2D, which acts as a destination. So, create an array of points(coordinates x,y,z), in a series, in an order you wish for the a.i. to follow. Starting with the first point, find the angle between the object and the point. Move the object in that direction calculated, checking the distance between the two constantly.

If the distance between the two are within, let's say 1 unit, then switch the object's destination to be the next waypoint. This is not too specific, however, I will write up a quick program in 3D to show you these words in action.


+NanoBrain+
GALACTUS
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 5th Jul 2005 10:02
I would very much appreciate that Nano..

Thanks again,

DB&OQ

Hey!!
GALACTUS
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 7th Jul 2005 04:43
Nano? Did you happen to wright that code? I would really appreciate it.


Thanks,

DB&OQ

Hey!!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 8th Jul 2005 05:58
Oh nm the email I sent I misunderstood you. I didn't even see this thread. Pathfinding is definately the easiest to do that with. If you are using CSHOP and the .csm importer it is even easier as you can place the way points when you build the map. You can then start off with some easy code like if object is within 1 unit of a waypoint then it is at that waypoint, point the object to the next way point and move, when within 1 unit of that way point ... point at the next and so on. You can make it as complex or simple as you desire. You could even place small collision boxes (static for speed) and use their collisions to move to the next waypoint.

NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 8th Jul 2005 16:59
DB and Other Questions,

I am still in the process of writing the example program for you, just busy in life. For now, check out this great link that the good man, Baggers, has posted in another thread. It's an a.i. system, called pathfinding.

http://www.policyalmanac.org/games/aStarTutorial.htm
Thank you Baggers.


+NanoBrain+
GALACTUS
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location:
Posted: 9th Jul 2005 04:32
OK..Thanks Nano

Hey!!

Login to post a reply

Server time is: 2024-09-23 23:18:49
Your offset time is: 2024-09-23 23:18:49