Jump to content

ZioRed

Members
  • Posts

    1,133
  • Joined

  • Last visited

Posts posted by ZioRed

  1. Thanks ziored Now I understand it. I spent a long time looking it up on google but all that foo stuff was beyond me.

    No problem, buddy. I edited my previous post with the reason why you usually want getter/setter method instead of changing directly the variable "mesh", it of course depends on your game/variables (for example you won't need getter/setter for a "speed" variable, so you will add it to "public" declarations of the class and change it like "actor->speed = 10");

  2. You can add a constructor to your actor class which accepts an entity as parameter:

     

    Actor.h

    class Actor {
    public:
    Actor(Model*);
    Model* GetModel(); // you want a getter method because you don't want your entity to be changed outside the class
    private:
    Model* mesh;
    }
    

     

    Actor.cpp

    Actor::Actor(Model* model) {
    mesh = model;
    }
    
    Model* Actor::GetModel() {
    return mesh;
    }
    

     

    How to use:

    Actor* actor = new Actor(Model::Load("mypath/mymodel.mdl")); // this line calls the constructor above
    // Now you can access its model
    Model* myModel = actor->GetModel();
    

     

    I hope it can clarify a little your doubts. This code is almost similar to what I'm using in my component based project.

     

    Now why would you want a getter method like GetModel instead of just adding a public member which requires lesser code? Take this example: for some reason you want your "actor" mesh to be changed dynamically, in this case you want of course at least that the new model has the same position and rotation like the old one, so instead of eventually duplicating the code in more than one part you want to call one only function everywhere that does it for you so you add a setter method to the class:

     

    Actor.h

    class Actor {
    public:
      //...
      void SetModel(Model*);
      //...
    }
    

     

    Actor.cpp

    // ...
    void Actor::SetModel(Model* model) {
      // Get the old entity's rotation/model, or default values if entity was not set
      Vec3 pos = (mesh ? mesh->GetPosition(true) : Vec3(0,0,0));
      Vec3 rot = (mesh ? mesh->GetRotation(true) : Vec3(0,0,0));
      // Release the old entity
      if (mesh)
         mesh->Release();
      // Set the new entity and assign the old position/rotation
      mesh = model;
      mesh->SetPosition(pos, true);
      mesh->SetRotation(rot, true);
    }
    // ...
    

     

    so to change the current model you'll only write:

    actor->SetModel(Model::Load("mypath/myothermodel.mdl"));
    

  3. Ok, i tried fresh install and still dont work with other path then c:\leadwerks ?

    It seems more an issue with the templates (may be the template sources are released with full path to C:/Leadwerks, I didn't try but off the top of my head I bet it is so), you should look at your project settings, most likely it contains links to C:\Leadwerks folders for additional include directories, additional library directories and the path of Leadwerks.lib and OpenAL32.lib in the Library filter. To quick fix (if you don't want to manually change the project settings from the VS IDE) just open the .vcxproj file with a text editor and replace all "C:/Leadwerks" with your installation path, then I think it should work. If it still doesn't work then it's strange since klepto is not having this issue (I haven't a second HD/partition on bootcamp to try myself)

  4. So you only need to use System::GetProperty at the correct place where you want to load the map and it will automatically load the correct map from the editor.

     

    Well, at this point I think your meaning of "automatically" is far from mine...

     

    If you take care of my written words then you'll get what I'm suggesting here is: avoid workarounds, avoid scripting and avoid changing source code or exit the editor for something that should logically be there.

     

    There's no need for you to fight a perfectly logical request with workarounds, I am definitely not a hobbyist, I am a business company not for love or hobby, and if I wanted to go through workarounds then I would have gone for open source, don't you think? wink.png

     

    I don't think this request is so odd, and the reason why I am still here after 3 years is because I would like to support LE and help as I can to push it to the other big stars, else there wouldn't be any point for me to be still here since I already own other much higher-priced licenses too rolleyes.gif

     

    However this is my suggestion, let's stop this flame between us and leave to Josh the faculty to accept or decline, I can perfectly live with the current workflow, but since this is SUGGESTION forum then I like to suggest what could be useful.

  5. i don't understand. If i press play in the editor it already starts the current map i have open in the editor.

     

    thats the reason why the default code uses System::GetProperty("map","Maps/start.map");

     

    i think you could also just start the exe with a parameter -map

     

    The answer is exactly in your sentence: it starts the map that you're loading from the C++ project, not the scene you're currently viewing in the editor (that is if you're creating a new scene, not "start.map", you cannot run it in the editor until you change your C++ code). Starting the EXE with parameter is simply not an option, since you have to open a prompt console to execute, while it should logically be done from inside the editor itself. Also take for example your artist is doing the level 2 of your game, with the current workflow he will need to play the game from start and complete successfully level1 before he can see the new work-in-progress level, "oooops I put that object in the wrong place/rotation" so quit the debugger, apply the patch and again have to play the game from start and so on... definitely not feasible for a team work (and neither for one-man, in my opinion, too much steps to only see how your new scene is rendering).

  6. I do everything in code but hoping to do more level designing as it would be a pain to design these levels in code (but not impossible).

    Wtf I would have changed job/role/engine if I had to build levels in code, too lazy that is why I never approached XNA eheh

  7. I think technically they are global, but the compiler does not "know" them out of the .cpp itself. If you really really need global variables (*argh* I find them very bad in OOP design) you should declare and initialize them in the .h file, then where you need to access them you will include that file. But since global variables (and global functions) are definitely not OOP, I think a more elegant way would be to add those variables into a class.

     

    EDIT: well, I tried now to declare a variable in a .h out of the class declaration and the compilation failed, so it seems you should add them to a class.. sorry, there's still something I need to recall from the past, didn't use C++ from long time, so probably the other guys could be more specific and clear. Here is: http://www.learncpp.com/cpp-tutorial/42-global-variables/

  8. In the editor it would be cool if we could play the actual scene loaded too (by adding another Play button), instead of only being allowed to run the full (compiled) project. I think this is a must have feature especially for level designers, currently he has to wait for the programmer to add the code/script to load the new scene (compile and send the EXE to the designer).

    • Upvote 2
  9. In the editor, when you have a camera selected, it would be very useful to have a floating window where you can see the actual camera render preview. It would help to position the camera exactly as you like without having to play/stop ten times to adjust the view.

     

    Also another useful feature would be to add a command in EDIT menu to align the current view to an objected selected in the scene (and reverse, that is align an object to the current view).

  10. Personally I would move the camera towards the target (player) until no collision is detected (if it ends up to be too close to the character then would switch to 1st person as well) and also at defined close position I would switch the material of the character to use an alpha transparent shader so you won't have the view blocked by your own character. It's not something I did in LE till now (but may be I will give it a try) but this is something I'm used to do elsewhere.

  11. PDB files contain debugging information, since it is OS specific (and most of us haven't these files in our OS) then you're having these warnings. But you can completely ignore them, if you don't want these warning when building in debug configuration then you can try to add the following line in your "main" file to disable only this warning:

     

    #pragma warning (disable : 4099)
    

     

    I don't know if this workaround works only on VS, may be it is.

  12. It's not a problem with animated characters since I had same issue with primitives. I hope it will be changed so that we'll not be forced to have an empty script or having mass. Also having a callback for each entity is definitely not needed, it would be much better to have an Entity::Find to search for an entity by name among all the currently active entities (indipendently from having loaded a map or instanced through code), but leaving a callback to be called after the map has been fully loaded (that is all its entities loaded, not one by one that is unuseful if we had a generic Find).

  13. I have a prefab for my player like this: http://imageshack.us/f/46/leplayerprefab.png/

     

    "Player" in the hierarchy is a pivot, while the SKIN_MESH is the barbarian .mdl, with mass 0, since the real physics properties are set on the pivot. The prefab is loaded of course through Prefab::Load and I'm trying to use PhysicsSetPosition and PhysicsSetRotation to move it around by key presses:

     

    float move = 0;
    float turnspeed = 2 * Time::GetSpeed();
    
    if (App::instance->window->KeyDown(Key::Up))
      move = 2;
    else if (App::instance->window->KeyDown(Key::Down))
      move = -2;
    
    if (App::instance->window->KeyDown(Key::Right))
      movement.y += turnspeed;
    else if (App::instance->window->KeyDown(Key::Left))
      movement.y += turnspeed;
    
    
    Vec3 pos = model->GetPosition();
    model->PhysicsSetPosition(pos.x, pos.y, pos.z + move * Time::GetSpeed(), 0.5);
    model->PhysicsSetRotation(movement.x, movement.y, movement.z, 0.5);
    

     

    ..but it does not move or rotate. I tried to use similar code with an entity created through code (like in the reference page) and it works there, so what is the problem? Cannot I use this code with a pivot having physics?

     

    Thanks

  14. Oh thanks Rick, I'm currently just making tests to see how LE3 works.

     

    A request has been made in the suggestion forum for this behavior.

    Cool, because it's like a hack to create an empty script. Also the callback for each child of a model is pretty weird, I think it should be called only on the model root entity (and also the root of other models attached to it by the user in the editor, e.g. when you add a weapon to a character [it's not the case of barbarian since the weapon is inside the model itself]).

  15. I have a map with only 2 cubes, one for the ground and one in the middle of it (no camera, light or anything else, I'm creating the camera through code). When I add the hook to Map::Load to cycle through the loaded entities, it isn't called at all for the cubes.

     

    Here is the code:

     

    void SceneLoaded (Entity* entity, Object* extra)
    {
    string text = entity->GetKeyValue("name");
    std::stringstream ss;
    ss << "Entity: " << text;
    Print(ss.str());
    }
    
    Map::Load("Maps/start.map", SceneLoaded);
    

     

    It seems that the callback is not called for any primitives, since I noticed that if I add a directional light, a camera or a model then the callback is called for only these kind of entities.

     

    Am I doing something wrong? Are you having this issue too?

     

    Also the callback (when gets called) is called for each child of an entity, so in example for the barbarian model the above code prints:

    Entity: SKIN_MESH
    Entity: BarbarianPelvis
    Entity: BarbarianLThigh
    Entity: BarbarianLCalf
    Entity: BarbarianLFoot
    Entity: BarbarianLDigit110
    Entity: barbarian_knee_pad_L
    Entity: BarbarianRThigh
    Entity: BarbarianRCalf
    Entity: BarbarianRFoot
    Entity: BarbarianRDigit111
    Entity: barbarian_knee_pad_R
    Entity: BarbarianSpine1
    Entity: BarbarianSpine2
    Entity: BarbarianSpine3
    Entity: BarbarianRibcage
    Entity: BarbarianLCollarbone
    Entity: BarbarianLUpperarm
    Entity: BarbarianLForearm
    Entity: BarbarianLPalm
    Entity: BarbarianLDigit11
    Entity: BarbarianLDigit12
    Entity: BarbarianLDigit13
    Entity: BarbarianLDigit21
    Entity: BarbarianLDigit22
    Entity: BarbarianLDigit23
    Entity: BarbarianLDigit31
    Entity: BarbarianLDigit32
    Entity: BarbarianLDigit33
    Entity: Barbarian_weaponL
    Entity: barbarian_shield
    Entity: barbarian_arm plate_01_L
    Entity: BarbarianRCollarbone
    Entity: BarbarianRUpperarm
    Entity: BarbarianRForearm
    Entity: BarbarianRPalm
    Entity: BarbarianRDigit11
    Entity: BarbarianRDigit12
    Entity: BarbarianRDigit13
    Entity: BarbarianRDigit21
    Entity: BarbarianRDigit22
    Entity: BarbarianRDigit23
    Entity: BarbarianRDigit31
    Entity: BarbarianRDigit32
    Entity: BarbarianRDigit33
    Entity: Barbarian_weaponR
    Entity: barbarian_sword_03
    Entity: barbarian_arm plate_01_R
    Entity: barbarian_shoulder pad_03_R
    Entity: BarbarianNeck
    Entity: BarbarianHead
    Entity: bon_gob_war_jaw
    Entity: bon_gob_war_face
    Entity: barbarian_helmet_02
    

  16. I didn't succeed to use VS2012 because of error "LNK2038: mismatch detected for '_MSC_VER'" related to Leadwerks.lib (don't know if I'm the only getting this error, but since I have also VC++2010 installed then I'm currently using it for LE), so I had two choice: go back to the old VS2010 or change project properties/general/platform toolset to "Visual Studio 2010 (v100)".

     

    As soon as you succeed to compile the project in Visual Studio you will be able to run from LE editor too.

×
×
  • Create New...