About Store Forum Documentation Contact



Post Reply 
ObjCreate / ObjCreateNear issues
Author Message
Tottel Offline
Member

Post: #1
ObjCreate / ObjCreateNear issues
I have a custom "Player" class, inheriting from Game:Chr. I have a ObjMemx container in my main class, and I've done .setObjType(Player, OBJ_PLAYER)

When I retrieve my .obj (type is OBJ_PLAYER), and do .objCreate, everything works fine: My player shows up fine, I can control him, it works.
However: I cannot access him in the Players container. It says it has 1 element inside, which is invalid. How is that possible?

Secondly, if I use .objCreateNear, nothing shows up, nothing happens. I'm creating at the Cam.at, but it doesn't even go in the if-structure.

Code:
    // Create the player
    EE::Game::ObjParamsPtr playerParams = EE::Game::Objs.ptrGet("obj/chr/human/0.obj");

    if (Game::Obj* obj = EE::Game::World.objCreateNear(*playerParams, Matrix(playerParams->scale(), Cam.at))) // create new object at position and give objects default scaling
    {
        Player* player = CAST(Player, obj);
    }
(This post was last modified: 12-15-2012 04:15 PM by Tottel.)
12-15-2012 01:01 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: ObjCreate / ObjCreateNear issues
Hello,
Quote:However: I cannot access him in the Players container. It says it has 1 element inside, which is invalid. How is that possible?
probably the object was created in the container, initialized, and flushed to temporary memory (removed from container, because it was detected outside of active range)

Please check if that's the case:
-you create object
-it is out of active range so it gets flushed
-then you change new active range and/or active center
-object gets loaded because of active changed
-you can see it in the game
12-22-2012 03:32 PM
Find all posts by this user Quote this message in a reply
Post Reply