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 / My own Matrix Editor?

Author
Message
Lord FireFox
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 16th Jan 2005 11:08
Is it possible to make a Matrix editor without needing a bunch of insane math?

I already have a basic edior setup but I have no idea how to raise or lower the points on the terrain with the mouse. and I'm wondering if its possible without alot of complicated math.

I don't like the idea of using heightmaps but I will if I have to.

And please don't link me to someone elses shareware editor otherwise I won't learn anything. I'd rather use my own code.

Thanks for any help.
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 16th Jan 2005 23:38
Quote: "Is it possible to make a Matrix editor without needing a bunch of insane math?"

Yes.
set matrix height id,xile,ztile,height

ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 17th Jan 2005 00:02
Its easier to raise and lower points. But using the mouse to do it is abit more difficult.


Too difficult for me.


http://www.dbspot.com/NYC
New years competition... Fo Shizzle.
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 17th Jan 2005 03:04
Ahh! I found my 20 line challlenge entry.

Make Matrix 1,1000,1000,50,50 : Make Object Cone 1,50 : Color Object 1,rgb(0,255,0) : rotate object 1,180,0,0
Sync On : Sync Rate 30 : Hide Mouse : Position Camera 500,500,-500 : Rotate Camera 20,0,0
Do
if mouseclick()=0 then X#=X#+mousemovex() : Z#=Z#-mousemovey() : Y#=get ground height(1,X#,Z#) : position object 1,X#,Y#,Z#
if mouseclick()=1
if X#<1001 and Z#<1001 and X#>-1 and Z#>-1
Y#=Y#-mousemovey()
position object 1,X#,Y#,Z#
set matrix height 1,(X#/20),(Z#/20),Y#
update matrix 1
endif : endif
if inkey$()="s" then gosub save
Sync : Loop
Save:
dim mtx(1,50,50)
for x=0 to 50 : for z=0 to 50
mtx(1,x,z)=get matrix height(1,x,z)
next z : next x
save array "C:\level.mtx",mtx(0)
return

You can then use this load function.
Load:
dim mtx(1,50,50)
load array "C:\level.mtx",mtx(0)
for x=0 to 50 : for z=0 to 50
set matrix height 1,x,z,mtx(1,x,z)
next z : next x
update matrix 1

Obviously you can change the filename but I had to keep it to 20 lines. If you want any explanation then let me know.

Lord FireFox
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 17th Jan 2005 08:07
Thanks, if I have any questions I'll be sure to post them.

Thats pretty impressive for 20 lines of code.
BaZko
20
Years of Service
User Offline
Joined: 24th Sep 2004
Location:
Posted: 17th Jan 2005 09:02
nice,i might use that code.

Join the new years contest!
Lord FireFox
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 17th Jan 2005 14:00
I noticed its kid of limited to the size of the matrix, also when I rotate my camera round my matrix my cursor\marker doesn't update its facing direction.

Its also a bit off centered with matrices bigger than 1000x1000

And I do have one question, I want to have my wireframe showing through my textures so I know exactly where I'm editing, I used the wireframe commands in the Matrix Commands list but it made my textures dissappear. Is it possible to have the gridlines show through the texture without removing the textures?

I made a workaround for it so far using my own grid texture and then painting over that with another texture when I need to so I have a general idea of where my gridlines are. Its a band-aid solution at best though.
Ralen
21
Years of Service
User Offline
Joined: 22nd Jul 2003
Location:
Posted: 19th Jan 2005 02:32
There is another way to do it. Place an object at each vertex in the matrix. Just a tiny cube. When the mouse is over the object you can clickandhold then move the mouse up or down depending on what you want to do with that vertex. What you would actually do is is save the matrix information to an array and modify those values then update the array accordingly.

Its been a while since I played with DBP, I'm just now getting back in to it. Something like this should be pretty easy to accomplish. makes it a lot easier to do.

Well soon as I get home I'll dabble a little bit and upload the example.

Ralen
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 21st Jan 2005 04:41
Sweet code wish i could write that the only problem i have is when i come to load the matrix it says

"Matrix does not exist at line 6"
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 22nd Jan 2005 05:36
Yeah. That is because you have to have:

Should work then.

Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 23rd Jan 2005 04:29
works great thanks
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 24th Jan 2005 03:15
Lord FireFox
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location:
Posted: 28th Jan 2005 14:09
Hey Ralen you upload the example yet?
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 29th Jan 2005 18:19
Something like this:

I haven't been able to test it but in theory if you mess it around a bit then it will work.

Login to post a reply

Server time is: 2024-11-27 20:35:39
Your offset time is: 2024-11-27 20:35:39