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.

DarkBASIC Discussion / matrix surface

Author
Message
koolaid
23
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 23rd Mar 2003 07:44
how can i get the enemies in my game to follow the matrix height its different sizes everywhere when they come after me they pass through the matrix where its not flat i want them to follow the surface.
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 23rd Mar 2003 11:21
get ground height

Why the hell'd you ask me for crying out loud!?!
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 23rd Mar 2003 14:44 Edited at: 23rd Mar 2003 14:45
I saw too answers to this recently, one from me one from someone else - if only there was a search feature *cough*

Basically you read off the height infront, behind, to the left and right of the vehicle. We'll put this into front#, rear#, left# and right#

After the sync, you then reverse your rotations in backwards order so that the next time you read the ground height you read the correct co-ordinates. For this reason it is necessary to store the vehicles yrotation in a variable rather than apply rotations directly to the object, we'll store this in vehicleFacing#

To adjust the amount that the vehicle rolls by either read from a distance further away from the centre of the vehicle, or multiply/divide the sum of the subtraction.

roll object right vehicleObject,right#-left#
pitch object up vehicleObject,front#-rear#
turn object right vehicleObject,vehicleFacing#
sync
turn object left vehicleObject,vehicleFacing#
pitch object down vehicleObject,front#-rear#
roll object left vehicleObject,right#-left#

There are other ways that may be better, faster or whatever. However this method works for me because it's pretty easy for my small mind to understand it

It's been a while since I used DB Classic now, but if I recall correctly it is neccesary to fix the object pivot after each rotation, but i'm not sure.

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
John H
Retired Moderator
23
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 23rd Mar 2003 16:26
Yep, they are right, just use GET GROUND HEIGHT for object Y position, then position the enemies at that coordinate at all times. Should be the same for your character.

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy! Oh ya, and Tat has a plugin for that!
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 23rd Mar 2003 18:02
Ooops sorry - I was answering the wrong question My explanation was to make a vehicle roll over the terrain, indeed positioning a soldier to stand on a matrix is really just as simple as the other guys are saying

Pneumatic Dryll, Outrageous epic cleric of EQ/Xev
God made the world in 7 days, but we're still waiting for the patch.
koolaid
23
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 23rd Mar 2003 22:34
so your saying position the enemie character and for the y position get ground height because i believe i did that but something went wrong even if the enemie is moving around where the height changes will they follow
koolaid
23
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 23rd Mar 2003 23:01
i placed the creature somewhere where the ground wasnt level for the y pos i get ground height(1,what is these two coordinates)
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 24th Mar 2003 04:46
The two coodinates are the coodinates of the position on the matrix. DB doesn't automatically detect which object you're using and hence what the coodinates are (you're getting into the C&P realm, there).

Basically, this is the sort of code you'll need to put within your loop:

creature_y# = get ground height(1, creature_x#, creature_z#)
position object 1, creature_x#, creature_y#, creature_z#

Hope this helps!

"I am a living, thinking entity who was created in the sea of information."
koolaid
23
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 24th Mar 2003 06:58
okay i did position object 1,put in the x position and z position for the y i got the ground height but when i make the object walk forward it doesnt follow the matrix it just goes straight on the same height level and doesnt move with it do i have to write something to keep getting the ground height when the creature moves to different places where its not the smae height?
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 25th Mar 2003 01:30
Yes, that's why I said you should put this code in your loop. It's no good getting the ground height for one point and then moving to another without getting the new ground height!

"I am a living, thinking entity who was created in the sea of information."
koolaid
23
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 25th Mar 2003 02:05
okay dr doomer:so

(this goes before main loop)load object "mutantmove.3ds",1
scale object 1,3000,3000,3000
rotate object 1,0,180,0

do
creature_x#=
creature_z#=
creature_y# = get ground height(1, creature_x#, creature_z#)
position object 1, creature_x#, creature_y#, creature_z#
move object 1,-2
loop object 1
loop
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 25th Mar 2003 04:29 Edited at: 25th Mar 2003 04:31
Nearly there - try this:



I think that should work. I never use the move object command, so I'm not sure...

"I am a living, thinking entity who was created in the sea of information."
koolaid
23
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 25th Mar 2003 06:48
thank you again doomer your correct example worked but i forgot to get the position before the main loop but it works.have a question about the loop to place same object in multiple places(not random.
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 25th Mar 2003 10:10


arras
23
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 25th Mar 2003 13:18
if you were changing position of matrix, then you have to get height at its original coordinates. Means that if you positioned your matrix at co. 1000,0,1000 then you have to calculate where would be the point you want to get height of at position x-1000,0,z-1000.

I dont know if its bug, but moving matrix is not moving its height information.

Login to post a reply

Server time is: 2026-06-11 13:13:53
Your offset time is: 2026-06-11 13:13:53