Invisible Entities
Blitz3D Forums/Blitz3D Programming/Invisible Entities
| ||
I've decided to make a new thread on my previous problem, because I had no help with it before. Anyway... I have a level file, "lvl0.op" and it tells the code to load in all the objects and level data. Here's what it looks like: When it says "createobject," that tells the code to load in an object. The objects load fine, except for they are completely invisible - I know that because you can see collisions against them. Below are the "LoadLevel" and "CreateObject" functions: How would I make the entities visible? |
| ||
CreateObject(obj_type$, name$, obj_mesh$, el_dest, x, y, z, alpha, shine, xv, yv, zv, sx, sy, sz, rx, ry, rz) It looks like you forgot a float # on alpha in your function call defining it as an int. |
| ||
Your symptoms suggest a Alpha problem. One number misplaced in your load could throw off the alpha setting in the object creation. A integer 1 counts as a float 1. so, I would say the alpha is being set to 0. The alpha level is how transparent an entity is. A value of 1 will mean the entity is opaque. A value of 0 will mean the entity is completely transparent, i.e. invisible. Values between 0 and 1 will cause varying amount of transparency. This is useful for imitating the look of objects such as glass and other translucent materials. An EntityAlpha value of 0 is especially useful as Blitz3D will not render entities with such a value, but will still involve the entities in collision tests. This is unlike HideEntity, which doesn't involve entities in collisions. |
| ||
Yes, I understand alpha. ;) I know it is an alpha problem - but I've gone over the code a bajillion times and it seems as though I've made the alpha "1." I even changed this line: newObject\alpha# = alpha# to: newObject\alpha# = 1 And it still remained invisible. |
| ||
how about changing this line:EntityAlpha newObject\entity,1 |
| ||
OK, I got it working - turns out they were scaled SOOOO small I couldn't see them. :P Sorry for wasting your time! |
| ||
I'm assuming you've loaded the shapes in the past and they where visible. |
| ||
Try this code for example. As is, the value of alpha is set to a float and called as an int resulting in 0. Change the value to 1 (in the function call) without the . and it will show sollid. Change the value back to .5 and add # to alpha# in each case and you will see a tranparent cube. Graphics3D 640,480 SetBuffer BackBuffer() cam=CreateCamera() light=CreateLight() cube=CreateCube() ScaleEntity cube,2,2,2 cube2=create_the_cube(cube,.5) ;cube2=create_the_cube(cube,1) While Not KeyHit(1) PointEntity cam,cube2 RenderWorld ;Text 10,10,"alpha "+ alpha# ;Text 10,30,"alpha# "+alpha# Flip Wend End Function create_the_cube(cube,alpha) cube2=CopyEntity (cube) EntityAlpha cube,alpha PositionEntity cube,0,0,10 Return cube2 End Function |
| ||
Also, just a suggestion, everytime you load something and you asign an EntityType to it, you better add a ResetEntity() command at the end of the loading process, just to be sure the entity won't collide with anything else when you move and position it at its default position. bye! |
| ||
Eurythmia: Would it still be a problem if I called my collisions AFTER loading the object? |
| ||
"OK, I got it working - turns out they were scaled SOOOO small I couldn't see them. :P " Glad to here I'm not the only one to do that. |
| ||
"Would it still be a problem if I called my collisions AFTER loading the object? " I don't know for sure, it just happened to me once that the player got fixed inside a room when I loaded and reposition it,... after that day I always have a ResetEntity() command after loading stuff, just in case :) Paolo. |
| ||
OK. Thanks. I'm also having a problem with collisions to the level. For some odd reason, the player goes through the level. I'm pretty sure it is some sort of stupid mistake, but I can't figure it out. |
| ||
make sure the player is a meter or so above the ground when the game starts. And yes, to prevent collision problems while loading the level meshes enable collision AFTER loading. |
| ||
OK. Thanks, jfk. |