Does Blitz move invisible objects?
Blitz3D Forums/Blitz3D Programming/Does Blitz move invisible objects?
| ||
I'm experiencing a weird problem that I can quite explain. If I hide an entity and then move it, it doesn't seem to be moved until I unhide ( show ) it again. Is that the way Blitz works or is it a bug I've missed? If that's the way Blitz works, no sweat because I can just write my own HideEntity() and ShowEntity() replacements using alpha. But if it's not the problem, it's gonna come back to haunt me later. |
| ||
If you move an entity, it doesn't matter whether its hidden or not - it still gets moved. The only difference is that collisions are not performed on hidden entities. |
| ||
Wathc out using just alpha tho. The collisions sometimes stop the entity from being moved correctly :S If you try to move an entity from point a to b when alphed and point c lies inbetween and can be collided with, you light find you entity stuck :S:S |
| ||
What the drunk scottish person above is trying to say, is that collisions still happen on 0.0 alpha'd entities. :D |
| ||
Yeah, thanks, gfk. So watch out ! |
| ||
I'm not using any Blitz collisions. I only need very basic collisions in my game, so I wrote them myself. Quicker and less problems. ( This was before the recent collision bugfix, so it would have been worse. ) Anyway, the thing is this.. I'm hiding an object and moving it away, then I'm unhiding it and sending it moving from the new location. But thanks to the render-tweening I just added, it sometimes shows up at the old location. Now it's remotely possible that I'm putting it in the wrong position again somewhere deep in my code, but I think that's unlikely as it would never get back to where it is again. So the only explanation I can think of is that either Blitz, DirectX, or both, is not actually moving my object until I unhide it. I'm gonna write up new versions of the Hide and Show Entity functions and replace all calls to them to see what happens anyway. If anyone has a better idea of what might be going on, please let me know. |
| ||
Sorry, i don't use render tweening. Maybe it's tweening between the last position and it's current position tho. Maybe move it one frame before you show it?? |
| ||
I'm moving it many frames before I show it. That's why I think it's not being actually moved until it becomes shown again. |
| ||
That's strange and shouldn't happen surely :S |
| ||
Well.. I've made no changes to the code whatsoever apart from converting all calls to HideEntity() and ShowEntity() into calls to NewHideEntity() and NewShowEntity() which simply set the alpha to 0.0 and 1.0 respectively and the problem has ( maybe not so ) mysteriously vanished. So unless someone has an alternate explanation, I'm going to assume that Blitz doesn't move hidden entities until they're shown again. Or Direct3d doesn't, either way. |
| ||
The cone is moving... or did I missed something... Graphics3D 640,480,16,0 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() cone=CreateCone( 32 ) PositionEntity cone,0,0,5 HideEntity cone While Not KeyDown( 1 ) MoveEntity cone,0.01,0,0 RenderWorld Text 0,0,EntityX(cone) Flip Wend End |
| ||
The thing i never got: MoveEntity will collide, even if entity is invisible.. normal behavior and that's how it should be. PositionEntity.. will collide.. it's like Blitz MOVES the entity, instead of repositioning it. That's not how it should behave IMHO.. after all, the command says it all.. POSITION (ie: not move, as that's MOVEentity) entity.. This may be fixed tho, i stepped over to my own collision code after the Blitz collision (or lack thereof really) frustrated then hell out of me :) Tracer |
| ||
Call a "Renderworld 1" instead of "Renderworld tween#". When you use the regular hide command it's taken out of the rendering pipeline altogether. When tweening it'll interpolate from last shown position to new position. It will be positioned in its last known position first and then it will move quickly to the new location if you're using positionentity. Does it just stay in it's old location? |
| ||
Yep, thanks for the confirmation of what I thought Ban. I hadn't thought of using a RenderWorld 1, that's a good idea that I'll bear in mind for anything else that comes up. Using alpha has solved the current issue, but I wanted to be sure that I was right about things not being moved just in case it was a bug in my code. Tracer : Yep, I agree about that too. I can see why it's done, because it's common for people to do the moving internally with a velocity and a position for each object, adjusted for gravity/friction/etc and then positioned at the final coordinate. But nevertheless, you would think PositionEntity positioned instead of moving, from the name. TroM : Yes, you're missing something. I'm talking about physically moving the 3d mesh, not making an internal note of where the object is. I know Blitz acts like it's moved the mesh, but my experience tells me that it doesn't physically move the mesh when it's hidden. Maybe it's a Direct3d pipeline limitation, or a videocard thing, I'm not blaming Blitz, I just needed confirmation that the mesh is not moved when the object is hidden. |
| ||
Sybixsus, it actually moves the mesh, even when it's hidden, but when hidden, it's previous state is not captured again in CaptureWorld(), so when you show the entity back again it will try to tween between the position before the HideEntity() and the current position. There are two solutions for this: - Turn off render tweening; or - Show the entity before the CaptureWorld() function; |
| ||
Ah ok, well there are three solutions because, as I said, Alpha'ing to zero instead of hiding works too. |
| ||
Render tweening in Blitz leaves a *lot* to be desired. |
| ||
Any particular issues I should be aware of, Michael? Now that I've taken to alpha'ing to zero instead of hiding, everything seems to be working nicely. But if there are any particular issues I should watch out for, it'd be great to know now. |