Jump to content

Vulcan

Members
  • Posts

    92
  • Joined

  • Last visited

Posts posted by Vulcan

  1. Would be cool if we could select an entity and set keys for it via the editor instead of having to assign a script to do so. Sometimes we just want to identify something and don't need to attach a full script.

    You mean like for instance add properties, say hit points, defense points, mana etc? Because this could smoothen out the workflow as I would not need SQL for storing initial data. That would be great if so!
  2. I wish there was a pivot button on the left toolbar. Because I have begun to use pivots in the editor as placement markers for objects and other kinds of stuff made in C++, and I find it cumbersome to add pivots by "Object->Misc..->Pivots". If this button exist I would not have to leave the Scene tab as I am interested in add a pivot then immediately start naming it.

    • Upvote 8
  3. You can load your map and store all objects like this:

    Map::Load("Maps/mymap.map(), StoreWorldObjects());
    

     

    and then in your storeWorldObjects() function you can look up triggers. (Note that CSG objects need an empty script or a mass for them to be picked up by the load hook.)

    void StoreWorldObjects(Entity* entity, Object* extra)
    {
    if(entity->GetKeyValue("name") == "Trigger")
    {
    //Make a new trgger or something
    trigger = new MyTrigger();
    }
    }
    

     

    If you have made your own trigger class you can add a trigger hook in there:

    void MyCollisionHook(Entity* entity0, Entity* entity1, float* position, float* normal, float speed)
    {
    //A collision was made with the trigger
    }
    
    
    MyTrigger::MyTrigger()
    {
    entity->AddHook(Entity::CollisionHook, MyCollisionHook);
    }
    

    Okay that is working but now I got another problem when hidding the triggerbox in LE (Appearance->Hidden). Can't the box be invisible?
  4. With Lua I could use Script:Collision( entity, position, normal, speed) and place out a box-trigger.

    Found a video illustrating this in Lua:

    But how could I do that in C++?

    I have looked in Entity.h for clues and I suspect it might be OnCollision(...) but not sure howto. Maybe this should be mentioned in the documentation with an example.

  5. CSG gets collapsed with all the other CSG and you can't pull it out if this happens. There are 2 ways to prevent this collapse from happening and allow you to access the CSG. 1) Give it a mass 2) Attach a Lua script to it. If you don't want it to have a mass just make an empty entity script and attach it to the CSG and then you should be able to access it via your code.

    Thank you! Adding mass did the trick.
  6. Hi!

     

    I recently encountered a problem when I tryied to get an entity based on its name. First I made a box in LE as "Box 1" in the scene list/graph. And I was trying to find the entity "Box 1" in C++ but for some reason it does not show up. I am not sure how to interact with this box otherwise.

     

    list<Entity*>::iterator iter;
    for (iter = world->entities.begin(); iter != world->entities.end();++iter)
    {
    fileLogger.Log("Entity: " + (*iter)->GetKeyValue("name"));
    }
    

     

    When looking through the log I don't find "Box 1" anywhere.

    ...
    [21:13:39] Entity:
    [21:13:39] Entity:
    [21:13:39] Entity:
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: cardboardbox
    [21:13:39] Entity: Directional Light 2
    [21:13:40] Entity:
    [21:13:40] Entity: BarbarianLDigit110
    [21:13:40] Entity: BarbarianLFoot
    [21:13:40] Entity: barbarian_knee_pad_L
    [21:13:40] Entity: BarbarianLCalf
    ...
    

     

    In LE scene graph there is "Directional Light 2", several "cardboardbox" and last "Box 1". Rest is loaded from C++.

    I don't know what to do, please help!

  7. It is the time factor relative to the FPS.

     

    For instance:

    Your game runs at 30 FPS: Time:GetSpeed() returns 1.0f.

    Your game runs at 60 FPS: Time:GetSpeed returns 0.5f.

     

    Note: I used 30 fps as the base FPS. It could be 24 or some other value as well.

    Ookkii that's why I could not understand it. I tryied on a much slower PC and it GetSpeed() got atleast 10x if not 100x more in difference. I think I need to dig further with GetSpeed().

    Thanks smile.png

  8. I think you could just place out those cameras in LE editor and then create one camera in code, then just assign position and rotation of camera instead of switching camera.

     

    something like this:

    someCamera.FindCamera("AirportTowerCamera")
    camera->SetPosition(someCamera.GetPosition());
    camera->SetRotation(someCamera.GetRotation());
    

     

    But don't know how this method would hit the performance.

  9. Put an entity there?

     

    Long answer:

     

    Create a box at the start of your program. Hide it.

     

    Whenever you need to point something at a location:

    • Unhide box
    • Position it to location
    • Point entity at box
    • Hide box

    Thats quite a creative solution I must say, but still I think a Entity::LookAt(..) would look cleaner way to do it.

    This works and I think this is something that LE should have:

    void LookAt(Vec3 lookAt)
    {
    // Calculate angle from point A towards point B
    Vec3 tv = lookAt - obj->GetPosition();
    float tRoty = Math::ATan2(tv.x, tv.z);
    // Look at point B (height is excluded)
    obj->SetRotation(Vec3(0.0f, tRoty, 0.0f));
    }
    

     

    EDIT: Physics must be set to rigid mode temporary when SetRotation

    • Upvote 2
  10. Today I got into little problem with how to get a entity to look at a specific point Vec3(x, 1, z).

    I would suggest updating the Math::ATan2 documentation to include an example of how to do this with both C++ and Lua.

    I found this explaination usefull.

     

    Another suggestion could be to add a method for Entity class. Maybe something like:

    Entity::LookAtXZ(..) for 2d look at XZ (still usefull for 3d)

    Entity::LookAtXYZ(..) for 3d look at (ie: a players head looking at something, just like minecraft does)

  11. Never mind! I got it to work by temporary adjusting the physics.

     

    vGameObject.at(1).obj->SetPhysicsMode(Entity::RigidBodyPhysics);
    vGameObject.at(1).obj->SetRotation(Vec3(0.0f, 45.0f, 0.0f));
    vGameObject.at(1).obj->SetPhysicsMode(Entity::CharacterPhysics);
    

  12. I got a problem with SetRotation and tried all tricks I got in my pocket. The initial rotation works but thats it. I tried to rotate a model after it is created but seems to ignore it. The funny things is that SetPosition is working.

     

    This how I create it:

    void GameObject::Create(Vec3 position, Vec3 rotation)
    {
    //Create the player
    obj = Pivot::Create();
    obj->SetPosition(position);
    obj->SetRotation(rotation);
    obj->SetMass(5);
    obj->SetPhysicsMode(Entity::CharacterPhysics);
    //Create a visible mesh
    objMesh = Model::Cylinder(16, obj);
    objMesh->SetPosition(0.0f, 1.0f, 0.0f);
    objMesh->SetScale(1, 2, 1);
    }
    

     

    Another place in the project I try to rotate the object (1) like this:

    vGameObject.at(1).obj->SetRotation( Vec3(0.0f, 45.0f, 0.0f) );
    

     

    But this however works:

    vGameObject.at(1).obj->SetPosition( Vec3(-10.0f, 1.0f, 0.0f));
    

     

    Is it a bug with LE or is it me that aren't doing something right? This is driving me nuts!

    Please help!

  13. It would be awesome if Leadwerks could have models (archer, knight, etc..) like in Chivalry game with typical animations. I think good quality characters is importent because those models are closest to the camera in FPS and TPS in my opinion.

  14. Okay I did thought fstream was self contained as I don't have this problem with other projects (not LE based). Thanks for clearing this issue, I am sure this might be handy for other as well.

    Thank you!

  15. I have encountered problem when trying to include fstream into one of my header classes. Visual Studio 2013 express gives my immediately this error:

    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\fstream(39): error C2065: 'EOF' : undeclared identifier

     

    At first I thought it might be a bug with VS but then I found FileSystem::ReadFile as method of reading the file. But still if for reason <input here> that I would like to use fstream, how would I do that?

     

    Do I need to rewrite every files in my project that use fstream? Not that's a problem just curious.

     

    Still not sure if this is a bug or intended.

  16. I would also like to have the models in *.blender format.

    Some quick ideas:

    • Human: 3 males (young, middle age, old) + 3 females: Idle, Walk, Crouch, Run, Strafe(left/right), Jump, Die, Attack:Fist, Attack:Sword/staff, Attack: Gun, Sleep, Ladder, Pickup object (ie: bend forward to open chest), Use object/arms (to use key or assemble something), Falling, almost falling (on edge), Swimming, Dancing, Happy emotion, Angry emotion, Talking...
    • Alien (the grey) + UFO
    • Zombie (male+female)
    • Android/Robot
    • Animals: Wolf, Bear, Fish, Frog, Bird, Snake
    • Insects: Spider, Ants
    • Bosses: Dragon, Cyclops/Titan, Evil wizard
    • Medieval: Knight, Pikemen, Archer, Mage/Wizard
    • Ships: Aeroplane(modelplane), Spaceship (aka StarFox), Spacerocket (aka Kerbal Space Prog.)
    • Weapons: Boa staff, Pike, Short sword, Long sword, Bow & arrow, mage staff/wand
    • Items: Ammo box, Health kit, Health potion, Mana potion, Keys, Gems, Money, Gold coin, Gold bar, Gold nugget, Brass gear, Book

    Just my 2 cents!

     

    EDIT: Battery + Guns + Ghost + Skeleton + Food

  17. I find this quite usefull when thinking about releasing the game, by having some benchmarks to compare it. What should I set as minimum requirements and recommended req.

    I have borrowed a laptop so here is my spec and benchmark:

    FPS: 45-55 but have drops to 30, seems quite laggy as I am used to 500+ (60 that is due to monitor) on my PC rig.

    Spec:

    CPU: AMD E2-1800 APU with Radeon HD Graphics 1.70GHz (Note: maxed out on CPU usage)

    RAM: 3.55 GB (4 GB installed)

    OS: Windows 8.1 64bit

     

    I think we need a standarised benchmark program.

×
×
  • Create New...