entity not positioned
Blitz3D Forums/Blitz3D Programming/entity not positioned
| ||
When I use tweening( before calling updateworld or renderworld and before the collisions have been set).I initially position my entity at x,y,z. it is not positioned there immediatetly or correctly. It is "tweened" and will not move to the correct position as it collides with the scenery before reaching the required position. It works just fine if I switch off tweening any ideas as this is really anoying;( cheers |
| ||
I don't use tweening so I'm not 100% but have you tried hiding it first, then positioning it, then showing? |
| ||
Yes, this is a problem I wrote in about some time ago. I don't know how others are coding, but there didn't seem to be too much of a reaction; maybe a lot of people are using open terrains, with not much in the way. But I found that if there was a structure in the way then for at least one frame my camera hit the structure before being moved to where I'd asked. The answer was to to use two functions - ;-------------------------------------- Function GhostOn() ;-------------------------------------- EntityType hEntPlayer,0 EntityType hEntCamera,0 End Function ;-------------------------------------- Function GhostOff() ;-------------------------------------- EntityType hEntPlayer,TYPE_PLAYER EntityType hEntCamera,TYPE_PLAYER End Function - so, GhostOn() before PositionEntity, GhostOff() after. BTW the camera is parented to player (a pivot) - they both needed to have this effect applied. TYPE_PLAYER is of course your designated collision type. Come to think of it, Rob's answer may be even simpler - hide your player/camera, positionentity, then show your player/camera - probably has the same effect, and kills collisions while you reposition. |
| ||
your right, john. using hideentity and then showentity works as well |
| ||
Wow, a reply after 10 months! But, glad I could help. |
| ||
Wow, a reply after 10 months! He types reeeeeeeeally slow. |
| ||
Use 'ResetEntity' after you position the entity and before you do an 'UpdateWorld'. |
| ||
Bill, doesn't ResetEntity just set do the same as my line EntityType hEntPlayer,0 ? If used, collisions will have to be reset for that entity anyway after. |