entity not positioned

Blitz3D Forums/Blitz3D Programming/entity not positioned

zyd(Posted 2005) [#1]
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


Rob Farley(Posted 2005) [#2]
I don't use tweening so I'm not 100% but have you tried hiding it first, then positioning it, then showing?


John Blackledge(Posted 2005) [#3]
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.


mindstorms(Posted 2006) [#4]
your right, john. using hideentity and then showentity works as well


John Blackledge(Posted 2006) [#5]
Wow, a reply after 10 months!
But, glad I could help.


jhocking(Posted 2006) [#6]
Wow, a reply after 10 months!

He types reeeeeeeeally slow.


Zethrax(Posted 2006) [#7]
Use 'ResetEntity' after you position the entity and before you do an 'UpdateWorld'.


John Blackledge(Posted 2006) [#8]
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.