About Store Forum Documentation Contact



Post Reply 
Player mesh disappears after a while.
Author Message
Fluxor Offline
Member

Post: #1
Player mesh disappears after a while.
Hey there.

Another problem I came across:

I am working on an endless runner style game right now.
After a while, the player mesh disappears.

There is still the shadow (which however disappears 100 units later as well)
and the actor is still there,
because I still have collision and the camera is following the player.

Why is that? I am a bit lost here.
(This post was last modified: 08-26-2021 09:25 PM by Fluxor.)
08-26-2021 07:17 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #2
RE: Player mesh disappears after a while.
could you show your drawing function ?
08-26-2021 07:28 PM
Find all posts by this user Quote this message in a reply
Fluxor Offline
Member

Post: #3
RE: Player mesh disappears after a while.
I got the mesh fixed already, thanks.
I needed to iterate over the object in the render function --> case RM_PREPARE.

However, the shadow still disappears after pos.z > 200...

the code is this:
Code:
UInt RBall::drawPrepare()
{
   actor.draw();
   if(mesh) mesh->draw(actor.matrix());
   return 1;
}


void RBall::drawShadow()
{
   if(mesh) mesh->drawShadow(actor.matrix());
}




EDIT: Well, and after pos.z > 256 I lose control over the player.

It has an actor.velocity() function running in update,
that stops working after pos.z ~256, and I have a logging text running
for actor.pos(), that stops updating as well...

So looks like there is another thing going on which I don't know anything about...
(This post was last modified: 08-26-2021 09:36 PM by Fluxor.)
08-26-2021 09:07 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Player mesh disappears after a while.
https://esenthel.com/?id=doc#World_Manager
objects outside of world active range are automatically unloaded
08-27-2021 03:12 AM
Find all posts by this user Quote this message in a reply
Fluxor Offline
Member

Post: #5
RE: Player mesh disappears after a while.
Ok, I understand. But why does the shadow disappears at pos.z 200
and the Mesh is still there before I lose complete control at pos.z > 256?
That's what I can't quite understand. And I don't know how to fix that.

Also:

Game.WorldManager.update(C Vec &position) is set to the player.pos().

shouldn't that center the active area around the player then?

EDIT:
I also tried now to use a pointlight that moves with the player.
Here, the shadow also disappears, even a bit earlier than with the directional light.
Why??
(This post was last modified: 08-27-2021 01:47 PM by Fluxor.)
08-27-2021 01:10 PM
Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Member

Post: #6
RE: Player mesh disappears after a while.
it should, if you use the WORLD_MODE as WORLD_STREAM.

could it be some weird frustrum ?
08-27-2021 07:20 PM
Find all posts by this user Quote this message in a reply
KrysleQuinsen Offline
Member

Post: #7
RE: Player mesh disappears after a while.
IIRC, shadow/light stopped drawing due to camera and character exceeding the D.viewRange();
While Character got cached and disappear due to exceeding Game::World.activeRange();

You may want to try WORLD_FULL instead of WORLD_STREAM.
Game::World.mode(Game::WORLD_FULL );

Also, try to update WorldManager to Camera instead of a player position and move the camera along the player and see if it is improved.
Game::World.update(Cam.at); in the Game Update.
(This post was last modified: 08-28-2021 04:41 AM by KrysleQuinsen.)
08-28-2021 04:41 AM
Find all posts by this user Quote this message in a reply
Fluxor Offline
Member

Post: #8
RE: Player mesh disappears after a while.
Thanks guys, I will check after the weekend and report back.

However, I think that I tried this already, not sure though:
Quote:Also, try to update WorldManager to Camera instead of a player position and move the camera along the player and see if it is improved.
Game::World.update(Cam.at); in the Game Update.

This here:
Code:
Game::World.mode(Game::WORLD_FULL );
I tried 100% and it did some crazy stuff, can't remember what exactly,
but I switched immediately back to STREAM.

The camera is a follow cam (set to player[0].pos().z - 5 or something like that) anyways, because Endless Runner.

But I'll let you know how it goes when I can check.
Thanks again.
08-28-2021 01:24 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #9
RE: Player mesh disappears after a while.
I wouldn't recommend using the WORLD_FULL mode unless you have a fixed size level you want to completely load into memory whilst disabling streaming terrain and any automatic loading/unloading of objects. Endless runner screams STREAM to me.
08-28-2021 03:24 PM
Find all posts by this user Quote this message in a reply
Fluxor Offline
Member

Post: #10
RE: Player mesh disappears after a while.
Yeah I've noticed. Like I said above , I tried it and switched back to WORLD_STREAM right away because this didn't work at all...
08-28-2021 06:17 PM
Find all posts by this user Quote this message in a reply
Post Reply