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 / Objects moving about matrix

Author
Message
Bloder
17
Years of Service
User Offline
Joined: 24th Feb 2007
Location: Cyberspace
Posted: 29th Sep 2009 23:35
Hi, I've created a matrix, so you don't need to worry about that but I have a question.

I have built a model in AC3D and I want it to move around the matrix randomly. How do I do this?

If I were you, I'd make a game...
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 29th Sep 2009 23:45
Hmmm I am not sure if that natively supports exporting to the right formats. Here are the ones that darkBasic can load:

.3ds
.x

If the program can export to one of these filetypes, then all you need is LOAD OBJECT to bring it into your program (make sure the model is in the same directory as your code).

Then to move you can use the RIGHTKEY(),LEFTKEY(),UPKEY(),DOWNKEY() commands in conjunction with MOVE OBJECT and TURN OBJECT RIGHT and TURN OBJECT LEFT to make it move.

For placing it at the correct height of the matrix, you will need GET GROUND HEIGHT() and then use POSITION OBJECT to position the object at its own position in the x and z axis and for y you use whatever value you got from GET GROUND HEIGHT.

Make Sense?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th Sep 2009 01:51
If you want to randomly move it around, you can move it at a constant speed with MOVE OBJECT, and rotate it randomly with YROTATE OBJECT.



TheComet


Make the paths of your enemies easier with WaypointPro!
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 9th Oct 2009 21:40
Or you could generate a random point for it to aim for and make it face that direction and move towards it. Then when it reached it, generate a new target position. Obviously this could cause problems if you have objects like buildings on the matrix as it wouldn't automatically move around it. I haven't touched DBC in years so I can't remember the commands but in essence:



"A West Texas girl, just like me"
-Bush
Enlightened Gamer
14
Years of Service
User Offline
Joined: 4th Oct 2009
Location:
Posted: 20th Oct 2009 18:42
I have done this with several enemies on my matrix.

I used the following code and it works perfectly, they move around the map randomly.

Login to post a reply

Server time is: 2024-05-09 17:02:53
Your offset time is: 2024-05-09 17:02:53