In trying to help some people out with learning how drawInfo works, I made a small sample object, and provided a number of comments on it. I am posting it here for reference.
material
name invisible
diffuse 0 0 0 0
alphathresh 0.2
#noradar
#noshadow
#noculling
#nosorting
end
material
name thingy
diffuse 1 1 1 1
alphathresh 0.2
#noradar
#noshadow
#noculling
#nosorting
addtexture caution.png
end
mesh
# set the center of the collision box as an inside point
# since the collision volume is convex, a single point is fine
inside 0 0 1
# define a list of verts, normals ,and UVs
# these will be used by both the tradtional mesh faces
# as well as the draw info.
#verts 8
#norms 6
#uvs 4
vertex 1 1 2 #0
vertex 1 -1 2 #1
vertex -1 -1 2 #2
vertex -1 1 2 #3
vertex 1 1 0 #4
vertex 1 -1 0 #5
vertex -1 -1 0 #6
vertex -1 1 0 #7
normal 1 0 0 #0
normal -1 0 0 #1
normal 0 1 0 #2
normal 0 -1 0 #3
normal 0 0 1 #4
normal 0 0 -1 #5
normal 1 1 0 #6
normal -1 -1 0 #7
texcoord 0 0 #0
texcoord 1 0 #1
texcoord 1 1 #2
texcoord 0 1 #3
#These faces are just used for colisions
# it has a material set that is invisible.
# these are NORMAL faces, just like any other mesh
# these are attached to the MESH, not the draw info
# they must go ether before or after the draw info section
# and can NOT be animated, LODed, etc. They are normal mesh faces
face # top
vertices 3 2 1 0
texcoords 0 1 2 3
normals 4 4 4 4
matref invisible
endface
face # botom
vertices 4 5 6 7
texcoords 0 1 2 3
normals 5 5 5 5
matref invisible
endface
face # x+
vertices 0 1 5 4
texcoords 0 1 2 3
normals 0 0 0 0
matref invisible
endface
face # x-
vertices 7 6 2 3
texcoords 0 1 2 3
normals 1 1 1 1
matref invisible
endface
face # y+
vertices 4 7 3 0
texcoords 0 1 2 3
normals 2 2 2 2
matref invisible
endface
face # y-
vertices 1 2 6 5
texcoords 0 1 2 3
normals 3 3 3 3
matref invisible
endface
# this is the actual drawn geometry
drawInfo
# the info for the octree
# the min X Y Z and max X Y Z of all the verts in this section
extents -1 -1 0 1 1 2
# the center X Y Z and radus of a sphere that includes all verts in this section
sphere 0 0 1 4
# spin it 40 deg per second
angvel 40
# define a set of unique XYZ, IJK, UV indexes as corners
#-x y to +x -y
corner 3 6 0 #0
corner 1 6 1 #1
corner 5 6 2 #2
corner 7 6 3 #3
# since the back side has a different normal, we make a difrent set of corners
# each corner index represents a unique combination of vert, normal, and texture coordinates.
# you MUST define texture coordiantes and normals when doing draw info.
corner 7 7 3 #4
corner 5 7 2 #5
corner 1 7 1 #6
corner 3 7 0 #7
# do just one LOD that used always
# you can do more then one LOD level
# and use a rougher geometric representation for further distances.
# this is the best way to make complex meshes run better
lod # 0
lengthPerPixel 0 # 0 means that this is used as the nearest one
# this would be incrased for further LODs.
matref thingy # group the items that use the same texture
dlist # put it into a display list
sphere 0 0 1 4 # tell the octree how big this part is
polygon 0 1 2 3 # call 2 polygons, one for each side
polygon 4 5 6 7
# Note
# draw info only supports draw info specific geometric primitives.
# normal mesh primitives, like face, meshbox, arc, etc are NOT valid
# inside a draw info section.
# you must use one or more of the following draw commands, followed by
# a list of corner indexes.
# points, lines, lineloop, linestrip, tris, tristrip,
# trifan, quads, quadstrip, polygon
# the equivalent command for a mesh face would be the polygon
end
end
end
end
material
name boxwall
diffuse 0 0 0 0
alphathresh 0.2
#noradar
#noshadow
#noculling
#nosorting
texture boxwall.ong
end
material
name caution
diffuse 1 1 1 1
alphathresh 0.2
#noradar
#noshadow
#noculling
#nosorting
addtexture caution.png
end
mesh
# set the center of the collision box as an inside point
# since the collision volume is convex, a single point is fine
inside 0 0 1
# define a list of verts, normals ,and UVs
# these will be used by both the tradtional mesh faces
# as well as the draw info.
#verts 8
#norms 6
#uvs 4
vertex 1 1 2 #0
vertex 1 -1 2 #1
vertex -1 -1 2 #2
vertex -1 1 2 #3
vertex 1 1 0 #4
vertex 1 -1 0 #5
vertex -1 -1 0 #6
vertex -1 1 0 #7
normal 1 0 0 #0
normal -1 0 0 #1
normal 0 1 0 #2
normal 0 -1 0 #3
normal 0 0 1 #4
normal 0 0 -1 #5
normal 1 1 0 #6
normal -1 -1 0 #7
texcoord 0 0 #0
texcoord 1 0 #1
texcoord 1 1 #2
texcoord 0 1 #3
#These faces are just used for colisions
# it has a material set that is invisible.
# these are NORMAL faces, just like any other mesh
# these are attached to the MESH, not the draw info
# they must go ether before or after the draw info section
# and can NOT be animated, LODed, etc. They are normal mesh faces
# EDIT since faces are only used for collision, there is no need to have
# anything other than vertices in faces. no matrefs, nothing.
# Drawinfo overrides anything sent from faces to the renderer?
# Or is it simply ignored?
face # top
vertices 3 2 1 0
endface
face # botom
vertices 4 5 6 7
endface
face # x+
vertices 0 1 5 4
endface
face # x-
vertices 7 6 2 3
endface
face # y+
vertices 4 7 3 0
endface
face # y-
vertices 1 2 6 5
endface
# this is the actual drawn geometry
drawInfo
# the info for the octree
# the min X Y Z and max X Y Z of all the verts in this section
extents -1 -1 0 1 1 2
# the center X Y Z and radus of a sphere that includes all verts in this section
sphere 0 0 1 4
# spin it 40 deg per second
angvel 40
# define a set of unique XYZ, IJK, UV indexes as corners
#-x y to +x -y
corner 3 6 0 #0
corner 1 6 1 #1
corner 5 6 2 #2
corner 7 6 3 #3
# since the back side has a different normal, we make a difrent set of corners
# each corner index represents a unique combination of vert, normal, and texture coordinates.
# you MUST define texture coordiantes and normals when doing draw info.
corner 7 7 3 #4
corner 5 7 2 #5
corner 1 7 1 #6
corner 3 7 0 #7
# do just one LOD that used always
# you can do more then one LOD level
# and use a rougher geometric representation for further distances.
# this is the best way to make complex meshes run better
lod # 0
lengthPerPixel 0 # 0 means that this is used as the nearest one
# this would be incrased for further LODs.
dlist # put it into a display list
sphere 0 0 1 4 # tell the octree how big this part is
# EDIT you can think of each polygon/tristrip/etc like an extended face.
# Each "matref" requires a corresponding "end"
matref caution
polygon 0 1 2 3 # call 2 polygons, one for each side
end
matref boxwall
polygon 4 5 6 7
end
# Note
# draw info only supports draw info specific geometric primitives.
# normal mesh primitives, like face, meshbox, arc, etc are NOT valid
# inside a draw info section.
# you must use one or more of the following draw commands, followed by
# a list of corner indexes.
# points, lines, lineloop, linestrip, tris, tristrip,
# trifan, quads, quadstrip, polygon
# the equivalent command for a mesh face would be the polygon
end
end
end
end
Take a look at my Defender game mode concept.
Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
yes technically you don't need the UV coordinates for the collision volume.
but you should define normals, they help out with collisions ( so we know what way the "outside" of the object is.
I don't believe you need a texture for an invisible object.
JeffM wrote:yes technically you don't need the UV coordinates for the collision volume.
but you should define normals, they help out with collisions ( so we know what way the "outside" of the object is.
I don't believe you need a texture for an invisible object.
If you add a texture, doesn't it apply the default? Not that it would matter, being invisible and all.