FreeEntity not working
Blitz3D Forums/Blitz3D Beginners Area/FreeEntity not working
| ||
Could someone please explain to me why I can't seem to delete the mesh under the label .c1 in this code? I made it just to use as CopyMesh template, but now that I'm done, I can't seem to get rid of it! This is also happening less noticably throughout this example. If you look close, you can see some of the - supposed to be - alpha .25 meshes are actually at double what they should be, which is funny because why would something I made a copy of ever be affected by an alpha change made to it's copy?! I mean you delete the original, and then not only is it still there, but it's being affected by commands too? Help!! :) |
| ||
That's just one big headache and asking for trouble :o) I have no idea tbh. Don't you have a modeller you could do this in. You need to look into arrays also. The only thing i can spot, is that the initial "horizontalbar0", is occupying the same space is "horizontalbar6" and therefore will overlap. That might be your problem. |
| ||
Funny thing is, with my cube creation code I posted up in another thread, I tried something different with it yesterday. I tried making a main cube mesh that I can just copy the rest from. But then when I tried to remove surfaces from a copy, it effected them all, which makes no sense why. I just went back to creating them when I needed them instead of copying from a single source. |
| ||
Yeah - your code is bloated and confusing. Is this what you want? Notice how much less code it takes .. Graphics3D 640,480,32,1 SetBuffer BackBuffer() Global camera=CreateCamera() PositionEntity camera, 5,10,-20 RotateEntity camera,30,15,0 CameraZoom camera,1.6 Global bar=CreateCube() ScaleMesh bar,50,.05,.05 Global Grid1 = CreateMesh() Global Grid2 = CreateMesh() PositionEntity Grid2, 0,-.15, 0 EntityAlpha Grid2, .25 For l = - 50 To 50 For d = 0 To 1 copy = CopyMesh( bar ) RotateMesh copy, 0 , d * 90 , 0 PositionMesh copy, l * ( d=1 ) , 0 , l * ( d=0 ) If ( l Mod 10 ) <> 0 AddMesh copy, Grid2 Else AddMesh copy, Grid1 EndIf FreeEntity copy Next Next FreeEntity Bar While Not KeyHit(1) UpdateWorld RenderWorld Flip Wend End |
| ||
Funny thing is, with my cube creation code I posted up in another thread, I tried something different with it yesterday. I tried making a main cube mesh that I can just copy the rest from. But then when I tried to remove surfaces from a copy, it effected them all, which makes no sense why. I assume you used copyentity rather than copymesh. In which case this is expected behaviour. |
| ||
!!!! Yea I used copyentity, I didn't think there was a copymesh. I'll have to try that thanks. CopyEntity is also probably why my player characters go invisible when more than one player of the same model type is hit by the enemy (I use EntityAlpha). |
| ||
Entityalpha works fine with instances ( copyentity ), it's only mesh manipulation commands what will effect all instances. |
| ||
Well I just tried it for my Players and it doesn't copy animations so, I'll just have to try it for my ground pieces later. Edit: Nope, I just tried using CopyMesh. It copied it, but there were two things I noticed were wrong. The copy... 1. It wasn't flatshaded like it usually is 2. It only had 1 surface instead of 5 (5 for the left,right,top,bottom,front) So... that's no good... I'll just have to use the old way, which works. |
| ||
These aren't wrong - you're only copying mesh data with copymesh, not entity brush properties or animations so, again, this is expected behaviour. If you are subsequently using addmesh then note that it combines surfaces which share the same brush properties - I'm guessing this is why the copy only has 1 surfaces instead of 5. |
| ||
Wow that's alot of replies. I'm at the library right now and can't read and respond to all this, but I will tomorrow. Firstly though, about it being bloated and confusing. I can't explain why, but for some reason ever since I first saw arrays I've hated them. I understand them, but I don't want to use them at all. I like having everything out on the table, not merged into one thing. It just makes coding more enjoyable for me. Sorry if it makes my posts annoying or something. Secondly, this is all I really did in the code basically: Make bar 0 Make three copies of it and move them into different positions Combine bars 1, 2, and 3 Delete bar 0 Why bar 0 won't go away, and why it's being affected by further changes to the three merged bars such as changes to their transparency, are the main things I'm confused about. Sorry if any of this was already addressed in the later posts, but I'm almost out of time here! :) |
| ||
You don't need to use arrays here, just a couple of simple loops as I've pointed out. If you find typing the same thing over and over more enjoyable than using loops or array's then so be it. Personally, I think it's just plain silly. I'm sure you'll realise this once you start writing bigger programs and find them a debugging and maintainance nightmare. |
| ||
Try writing minesweeper without types or arrays ;o) (or banks) |
| ||
Well, then we disagree. What else is new in the world, right? So any ideas about what might be making it impossible to delete bar 0? Or why it's being affected by changes to other meshes? It's not because I used CopyEntity, I didn't, I used CopyMesh. I would like to solve this. |
| ||
;PositionMesh horizontalbar6,0,0,0 ;AddMesh(horizontalbar6,horizontalbar0) As Ross has already pointed out bar 6 is in the same place as bar 0. Comment the lines above out and you'll see that it works. |
| ||
Thanks, I'll give it a try. |
| ||
Thanks guys! http://h1.ripway.com/fox95871/index.html |