Jump to content

TheConceptBoy

Members
  • Posts

    159
  • Joined

  • Last visited

Posts posted by TheConceptBoy

  1. Also in addition to the above issue. Can you see if I understand these functions correctly?

     

            void Attach(); Is called during instance creation / attachment to an entity, it's a single shot event. 
            void Detach(); Called when instance is destroyed / detatched from the Entity and the engine handle removal of all things related to it automatically.
            void Collision(Entity* entity, const Vec3& position, const Vec3& normal, float speed); Called upon collision with another instance.
            void UpdateWorld(); The main loop for this particular instance, called every cycle.
            void UpdatePhysics(); ? 
            void UpdateMatrix();
            void PostRender(Context* context);
            void Draw();  Called during drawing stage of the loop, perfect place for using the draw commands like 

    image.png.afc5d36d13040414e8318120e6d97d02.png
            void DrawEach(Camera* camera); ?

  2. Ok, on the side note, I've declared a whole bunch of functions in the .h file however I did not specify them in the cpp file for the zombie. Not that it changed anything, just a flashback from my last hair ripping C++ experience: 

    Currently my cpp file looks like this:

    image.thumb.png.ec406602cccd5ae411aed0e31027704d.png

    I'd like to point out that the ; error you see for the void of UpdateWorld is, I'm certain, is caused by the Attach function because if I move that function after UpdateWorld, then Detach will  get that error so something is up with Attach.

    EDIT: as the matter of fact. I can remove Attach and it will move the error to Detach, then deleting that makes it move to another function so yeah.

     

    And the header is : 

    image.png.6c718ffc84bfa57e2083a7d3674402d6.png

  3. 1 minute ago, Lethal Raptor Games said:

    You need to create an entity object first;

    
    Entity* entity = Entity::Box();
    entity->SetActor(zombie_001);

     

    I don't think there is such a thing as:

    Entity* entity = Entity::Box();

    If there is, it's not in the Docs. https://www.leadwerks.com/learn?page=API-Reference_Object_Entity

    There does not appear to be a Create() or a Box() for Entities.

     

    There is a Create for various things that are derived from Entity like Camera, Model, Light, Decal, Emitter

  4. Ah, ok, making progress.

     

    Would you know why in the zombie.cpp the UpdateWorld is complaining about a semicolon, and that it fixes itself by just moving the function above the Attach function? Both functions are empty and I don't think the order of function declaration in the .h file affects it. 

     

    Also the semicolon issue has moved on to here and I know for a fact that the issue is not somewhere above as when I delete these two lines, the application compiles just fine.

    image.png.41a2207250697ba54a8ebe209a3ad117.png

  5. Good day, I am writing this in hopes that after 4 minutes of posting this extensive question, I figure it out on my own.

     

    So apparently Leadwerks Actors system. from what I understand is an arbitrary method of creating classes that offer better integration within the engine than ordinary classes. If created properly, things like the main loop, creation and what not get executed automatically, saving you the trouble of creating your own main loop and putting in the code to update the main loop of the class yourself manually.

     

    I'm experimenting with say a class of zombies. In several locations, it's been said that when you are creating your own actor class, it should be based on the existing actor class generated by Leadwerks. I created a blank LW project and no such class was present in the project files. Furthermore, the docs outline that you use that existing class to create your own actor classes using inheritance. However once more there were no examples of how to achieve the mentioned inheritance. I did note that when you create a class in VS, it asks for a Base Class: Is this what the docs mean by creating a class based on the default one?

    image.png.7f45b8264fa7bc0a109a583d3d8b8091.png

    So I went with an assumption that I just need to include a few things when I create a class in order to make sure Leadwerks can trigger it's functions or Hooks as peeps call them.

     

    So my zombie.h

    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    
    class zombie
    {
    
    
    
    public:
    	zombie();
    	~zombie();
    
    
    	void Attach();
    	void Detach();
    	//void Collision(Entity* entity, const Vec3& position, const Vec3& normal, float speed);
    	void UpdateWorld();
    	void UpdatePhysics();
    	void UpdateMatrix();
    	//void PostRender(Context* context);
    	void Draw();
    	//void DrawEach(Camera* camera);
    
    
    };
    

     

     

    zombie.cpp

    #include "zombie.h"
    
    
    
    zombie::zombie()
    {
    }
    
    
    zombie::~zombie()
    {
    }
    
    void zombie::Attach() {
    
    }
    
    
    
    void zombie::UpdateWorld()
    {
    	System::Print("BaseActor UpdateWorld.");
    }
    

    image.png.755ee6a498bf60030b408a4672b9db51.png

    I have no idea WHERE it want's that damn semi in the code, However if I move the zombie::Attach() function AFTER update world, the error goes away. While it may fix the issue, I would still like to know why it's complaining in the first place so that perhaps I may have a clue next time.

     

    in the Main function before the application enters a loop, I get this:

    image.thumb.png.85974870e0baae15614b55677352fb1a.png

     

    now Everywhere (Forum, Docs etc) I see people doing this:

    image.png.1e6a9ef95b902df81b349347f773f426.png

    No need to create the actor variable using the class like BaseActor * baseActir = new BaseActor(); in order to store the new instance of object and same thing with entity. Where is this entity coming from? There's no Entity::Create() in the docs so I have no idea why it's complaining here.

     

    Appreciate all the help I can get.

  6. Just now, gamecreator said:

    I believe Josh adds some things for his personal use as he develops the engine but makes it available to us as well on the condition that it's not optimized and may break stuff.  At least, that's my understanding.

    Ah, I see. Very well then.

     

  7. 2 minutes ago, gamecreator said:

    The App stuff came about back when Leadwerks supported mobile.  I always delete them for new projects.

    The start code does various things.  I think part of it is interfacing with Lua.  Another is accessing the packaged data/zip file from code (the one created either by publishing a project).  A few other things somewhat documented with comments that go over my head.

    I watched only part of your video but it may also be worth mentioning (if you didn't already) that there are some undocumented functions not in the Learn section.  One I use often is world->FindEntity(string) to find entities in a map by name.  Use these at your own peril though as they may be unsupported.

    That sounds super useful gem. Why in the world is not NOT documented? How much more is there? Do we need to dive into the engine files to find out?

     

    EDIT: Ah... "unsupported" eh.

     

    If you use them then aren't they supported? Does it only work on a case to case basis or something?

  8. Now in this setting, I've basically voided the use of App.cpp and just deleted everything in the Mail.cpp file and used Leadwerks from scratch. 

    I am curious, what is the purpose of all that pre-existing code in a freshly created main.cpp and App.cpp? Debugging routines or something of the sort? 

  9. 3 minutes ago, gamecreator said:

    For this reason, it's best to use a pivot as a character controller and parent anything you'd like to it, like so:

    
    Model* player_sphere = Model::Box();
    player_sphere->SetPosition(0, 0.5, 0);
    
    Entity* controller = Pivot::Create();
    controller->SetMass(1);
    controller->SetPhysicsMode(Entity::CharacterPhysics);
    player_sphere->SetParent(controller, true);

     

    So that's a yes then? This is normal behavior for the character controller? The physics are calculated for a point in space instead of some sort of a volume objects? I take it the shape is meant for rigid bodies only then, not character controllers?

  10. Greetings everyone.

    I'm experimenting with C++ at the moment and it seems that the Box model I create via code is falling through the floor half way, I've even tried to attach a shape to it, however that does not seem to affect it in any way. Someone said that if a 3D model is falling through the floor, it needs to have it's x0, y0 and z0 to be at the feet of the chatacter. This is a simple box made in code and it feels as if the collisions with the world are being calculated for a single point, rather than a shape.

     

    
    	Model* player_sphere = Model::Box();
    	player_sphere->SetPhysicsMode(Entity::CharacterPhysics);
    	player_sphere->SetMass(1);
    	player_sphere->SetPosition(0, 10, 0);
    
    	Shape * pl_shape = Shape::Box(0,0,0, 0,0,0, 20,20,20);
    	player_sphere->SetShape(pl_shape);
    
    	Camera* camera = Camera::Create(player_sphere);
    	camera->Move(0.4, 2.4, -1);

    I just want to see if tis is normal behavior. All the ramp, plane and terrain collisions seem to be working ok. I can offset the camera. I just have a feeling that you would normally see the shape not sink half way into the ground as if the collisions are being calculated for the single center point as opposed to a 3D shape.

     

    EDIT1:

    Now i see that this question has been asked at least once already. Thread 1 and Thread 2 These people have been dealing with the 3D models. For now I just want to find out whether the objects, a simple box, created via C++ API commands, with a character controller for it's physics collision is supposed to be sunk half way in the first place? It seems so weird because, if I set the shape to a cylinder or a sphere, I can see the sides of the spheres colliding with the walls and preventing movement. Why does this also not affect the bottom of the sphere?

     

     

    • Upvote 1
  11. Thanks @gamecreator

     

    I got that much. All up and running now. I found my own post where I referenced the video tutorial that helped me getting up and running, and no wonder I couldn't find the damn thing, the dickhead removed it.... 

    I'm gonna get the C++ tutorial and and running on this myself.

  12. Good day, a little while a go I found some really nice tutorials on getting a Leadwerks C++ project running from scratch. I cannot find them now. The few topics in the docs are kind of all over the place. Where's the set up for windows, creating objects, loading maps, that sort of thing. Some of these things (like loading maps) I have found in the docs but the rest.... a mystery. YT is filled with Lua tutorials and a single C++ playlist from 2008, that thing can't be accurate, can it? 

    • Like 1
    • Haha 1
×
×
  • Create New...