Area Change affected by gravity
Blitz3D Forums/Blitz3D Programming/Area Change affected by gravity
| ||
When my character changes area in a 'half seamless' fashion (eg: Halo where you walk through a room from which you cannot see others, and it load while telling you to please wit) He falls through the floor. Of course the new area loaded is in Exact synchrony with the old one (in fact its the same for testing purposes), and has all its collission affections updated immediately after the area is freed and reloaded, so why should my players gravity take effect in this way? help! my main loop goes something like this: playerstuff.... if there is an areamesh >>gravity updateworld renderworld drawhud flip checkareas.... EDIT: Nearly fixed: I had to reestablish the collissions, but u still fall through thr floor. |
| ||
Have you got an example of some code? It certainly souinds like a collision problem (do you re-update the Player collisions, not just the level objects?) how is your gravity handled? is your player a mesh, a camera, a pivot combined complex collecion of children??? |
| ||
;loads the new area Function LoadArea2() CURRENTAREA=2 ;Light Settings AmbientLight 150,150,150 CameraFogMode cam,1 CameraFogRange cam,-2000,500 CameraRange cam,1,500 ;free prevoius mesh, if any If Not AREAMESH=0 FreeEntity AREAMESH ;load the mesh AREAMESH=sLOADMESH("3ds\HulkR.3ds") EntityType AREAMESH,areatype PositionEntity AREAMESH,0,0,-5 ScaleEntity AREAMESH,1.3,1,1.3 EntityPickMode AREAMESH,2,True EntityColor AREAMESH,158,158,158 AREACOLLISSIONS() end function ;this is called in the main loop after flip Function CheckAreas() Local NEWAREA NEWAREA=0 Select CURRENTAREA Case 1 If EntityX(cam)<=(-3898) NEWAREA=2 Case 2 If EntityX(cam)>(-3898) NEWAREA=1 End Select If NEWAREA>0 DrawImage LoadingNEWAREA,screenW/2,screenh/2:Flip Select NEWAREA Case 1 loadarea1() Case 2 loadarea2() End Select EndIf End Function gravity is just a negative y translation, which takes place if there is an Areamesh. collision with the area is entitysphere to area poly I'm going to try slightly increasing the players y co-ordinate when this point is reached, but its a strange solution, and will be rather noticable as a botched up job Edit:******************************************************** The Y increase wasnt too bad, and the re-establishment of player to area collissions was the real culprit, so thanks! |
| ||
Have you actually solved it? or just know where to look now? |
| ||
I had this problem. I found that since some time was taken in loading a new area, and my gravity was implemented within the main Tweening loop, Blitz tried to play 'catch-up' for lost time (which the tweening process should do). And so suddenly the code was looping through many instances of the gravity implementation before a collision could be detected. The only way I found around this was to switch off gravity as I changed areas, then wait till FPS > 5, then switch gravity back on. Sorry if that sounds a bit garbled, but it does depend on your own coding style. |
| ||
sounds like the kind of thing i would do. Its fixed close enough now: i just made it that my character moves up u few y after the change, so all thats felt is a 'loading jump' Thankyall |
| ||
Better if you can freeze your character during the transition, then if you're using tweening reset all the variables involved, so that the tween code does not rush round its loop playing catch up with its timers. |