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 / what is a mesh ?

Author
Message
_Ashley_
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 4th Jan 2005 18:10
hi can anyone please tell me what is meant by a mesh.

i recently came across the following code and am unsure of its purpose:

rem Create Floor template
template=1001 : make object cube template,200
make mesh from object template,template
delete object template

Thanks.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Jan 2005 18:36
A mesh is an object that has no loaded texture and is a single mesh - like if you load a .x model as a mesh, it'd load it all as a single mesh (even if it was split up before), and with no texture. You then have to change a limb for your mesh, or create an object from it. The mesh is invisible until you create an object or modify and object with it.

Meshes are often used when dealing with memblocks too, you could create a mesh from an existing object, create a memblock from it, change something, then change it back into an object again.


Van-B


It's c**p being the only coder in the village.
_Ashley_
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 5th Jan 2005 19:48
ok so what would be the advantage of using the code above to create a mesh from a cube and use that as a template to create the level i.e why
would you not just make a cube each time

so instead of :

make object blockobj,1001,1001

use

make object cube

if you dont understand what i am asking try looking at the room demo source in the projects folder or let me know

Thanks again
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 5th Jan 2005 20:24
I don't have that source handy - but it could be 1 or 2 things.

Like - perhaps they're making 1 big mesh from the level, you could add all the cubes to a single object as limbs - then use it to check collision on or for actually showing the level.

Another reason might be speed, if you have a mesh and create an object from it - it's faster than creating an object from scratch because it has to actually create a cube rather than just converting internally.

It does make sense to use building blocks stored as meshes to build up levels, but for larger scale products it's not so straightforward as you'd need an editor to handle it all instead of just throwing the simple rooms together.


Van-B


It's c**p being the only coder in the village.
Los
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Location:
Posted: 8th Jan 2005 04:17
Could that mean I create two cubes, position one half intersecting the other, like a simple head and body... limb them together.. make a mesh of that object (2 cubes).. so it's one mesh. Then have to create another cube from the instance of one of the limbs.. make it smaller.. and stick it underneath the level floor or in the middle of the body/head itself to SEE the mesh?

I get the multiple copies from meshes.
Quote: "if you have a mesh and create an object from it - it's faster than creating an object from scratch "

I'd find out the command to call or modify THAT mesh.


saying all this. I havn't done anything with limbs yet. I've been living in the 2d part of DB. My next project I'll create two cylinders and a triangle to from a 3-piece bike. If I could make this a mesh perhaps it would help. The wheels will be moving up and down with hills. Maybe meshes would be handy to make afew copies of the bike?

When the bike hits the floor.. I would move the wheels up (from the position of the triangle.. maybe have a suspension variable.. this varies the distance of the wheels and the bike). The wheels would need to be controlled so they spin.. so I'm not sure if a mesh or single objects would be any better?
_Ashley_
19
Years of Service
User Offline
Joined: 31st Oct 2004
Location:
Posted: 8th Jan 2005 20:58
i have tried to make a level using the basic principals of the sample code i was using , however i get the error object already exsists could someone please point me in the write direction , by the way my code is still pretty simple because i want to test the level first.

-----------------------------------------------------------------------
level_setup:


rem create floor template
template=1001 : make object cube template,200
make mesh from object template,template
delete object template

pillar = 1


REM LOAD IMAGES

template=1001 : load image "floor.bmp",template

REM Create Room

blockobj=101
for z= 0 to 4
for x= 0 to 4
restore level_1
read mapid
if mapid=0
gosub _addfloor
gosub _addroof
endif
if mapid=1
gosub _addlowerwall
gosub _addupperwall
endif
if mapid=2
gosub _addpillar
endif
if mapid=3
gosub _adddoor
endif
if mapid=4
gosub _positioncamera
endif
next x
next z

return

_addfloor:

make object blockobj,1001,1001
set object collision off blockobj
position object blockobj,x*200,-100,(10-z)*200
inc blockobj
return


_addroof:

make object blockobj,1001,1001
set object collision off blockobj
position object blockobj,x*200,500,(10-z)*200
inc blockobj
return

_addlowerwall:

make object blockobj,1001,1001
set object collision off blockobj
position object blockobj,x*200,100,(10-z)*200
` coly=100 : gosub _setblockcollision
inc blockobj
return

_addupperwall:
make object blockobj,1001,1001
set object collision off blockobj
position object blockobj,x*200,300,(10-z)*200
`coly=300 : gosub _setblockcollision
inc blockobj
return

_addpillar:
make object cylinder pillar,200
position object pillar,x*200,100,(10-z)*200
inc pillar
return

_adddoor:
make object cube 10,200
position object 10,x*200,0,(10-z)*200
return

_positioncamera:
position camera x*200,400,(10-z)*200
return

Login to post a reply

Server time is: 2024-09-23 08:30:43
Your offset time is: 2024-09-23 08:30:43