Jump to content

Skrakle

Members
  • Posts

    79
  • Joined

  • Last visited

Posts posted by Skrakle

  1. Is model the actual character name or the name of its pivot physics controller?

    In my example, model is an Entity.

     

    Here's a brief example.

     

    // Declared in App.h //
    Entity* model = NULL;
    Vec3 model_rotation;
    
    // Loaded at start //
    model = Model::Load("Models/model_name.mdl");
    model->SetCharacterControllerAngle(180);
    model_rotation = Vec3(0, 0, 0);
    
    
    // In your loop //
    float rot_speed = 0;
    
    if (window->KeyDown(Key::Left))
    {
     rot_speed = -1.5;
    }
    else if (window->KeyDown(Key::Right))
    {
     rot_speed = 1.5;
    }
    
    if (window->KeyHit(Key::Escape))
    {
     model->Release();
     return false;
    }
    
    model_rotation.y += rot_speed * Time::GetSpeed();
    
    model->SetInput(model_rotation.y + model->GetCharacterControllerAngle(), 0, 0, 0, false, 1, 0);
    

     

     

    If you're still having issues, send me the model and i'll test it.

  2. Nope. No luck.

    I could fix this in 5 seconds in uu3d but its mdl format only.

     

    It the barbarian character from darkness awakes.

    Sorry, i forgot to tell you that you also need to add model->GetCharacterControllerAngle() where you set the angle with SetInput. This is how i'm doing it since i have a lot of models that are +180 as well.

     

    Example:

     

    model->SetInput(model_rotation.y + model->GetCharacterControllerAngle(), move_speed, 0, 0, false, 1, 0);

  3. Have you tried playing with lighting quality? I had issues with shadows too and i ended up setting the lighting to High to resolve it.

     

    In the editor: Options > Video > Lighting Quality (High) and don't forget to set it when game starts as well: world:SetLightQuality(2)

    • Upvote 1
  4. Setting the character angle in the editor does not work when the character loaded in by code.

     

    In fact it changed nothing in the editor as far as I could see.

    I had this problem before, if i remember correctly, this should fix it:

     

    self.entity:SetCharacterControllerAngle(180);

     

    (or c++) model->SetCharacterControllerAngle(180);

  5. It's one of the main reasons why i went from lua to c++ given the complexity of my game. I have so many classes and structs that for me, it would have been a nightmare to do all this in lua. As for speed penalties, i don't know, i never did any benchmark tests but i'm guessing that there might be.

  6. This is most likely due to one of the Macros in that line not being defined. You would have to search the headers for the definitions of those macros (most likely WINMAPI, MMRESULT, or WINAPI) and include those files and hope that they do not have additional requirements. Since this is a part of DirectX (DirectInput), you will most likely have problems with this, nevertheless.

    The error only occurs if included in a LE project. In an empty console c++ application, there are no errors and works as intended.

  7. I managed to rewrite my controller classes for native support (eliminating the need for the SDL lib) for both Linux and Windows but when i include dinput.h in a LE project, the compiler is giving errors, probably because it's conflicting somewhere somehow and i haven't been able to figure out how to fix it.

     

    1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\dinput.h(4318): error C2143: syntax error : missing ';' before '__stdcall'
    1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\dinput.h(4318): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    

  8. Hey everyone. I'm working on a level and after watching the AI tutorial multiple times, I still cant figure out how to get the AI to walk to the waypoint. Any help would be greatly appreciated.

    I had the same problem at first and it was because i didn't build a navmesh for the map. If you haven't already, go to TOOLS -> Build Navmesh.

     

    If you modify the map after that, you'll need to rebuild it again.

    • Upvote 1
  9. Works but that method in lua will cause the program to shut down half the time. Also, your method in lua appears to make the memory consumption go up each time. The SetLayout method doesn't do that - at least in lua.

    Yeah i was afraid that might happen in lua or even in linux, i guess it's unsafe to use. sad.png

  10. I just managed to make it work by releasing the window & context and re-creating them. I haven't tested it thoroughly, just wrote the code and it worked. smile.png

     

    Obviously you should replace the windows code for getting the desktop resolution with something else.

     

    In your loop:

    if (window->KeyHit(Key::F)) {
    	window->Release();
    	context->Release();
    	if (fullscreen == false) {
    		RECT desktop;
    		const HWND hDesktop = GetDesktopWindow();
    		GetWindowRect(hDesktop, &desktop);
    
    		window = Leadwerks::Window::Create("Lands of nowhere", 0, 0, desktop.right, desktop.bottom, Window::FullScreen);
    	}
    	else {
    		window = Leadwerks::Window::Create("Lands of nowhere", 70, 70, 1024, 768);
    	}
    	context = Context::Create(window);
    	fullscreen = !fullscreen;
    	return true;
    }
    

    • Upvote 1
  11. A pivot is an empty object and initialisation is just done one time at game start on the entity start() function, so i don't think it is some optimisation needed here.

    If you read my previous post again, you'll notice that i'm not only talking about speed optimization but memory as well which is my point.

     

    As for the pivot being an empty object, that is completely wrong, once initialized, there are objects in it are automatically initialized as well whether you're using them or not and will use extra (and unnecessary) memory... rolleyes.gif

     

    You should do some testing before making assumptions like that.

     

     

    Benefit of pivot is having having game level modifications is also more easy as you just move pivots visually, and you can't loose lot of time gathering coordinates and enter them if you had a big level with thousand platforms.

    It would be anti level designer productivity laugh.png

    It's like i said, there are people (such as you obviously) that need to see such things visually to be more productive, i don't.

     

     

    Edit:

    - I initialized 20000 Vec3s and it took about 1mb of memory

    - I initialized 20000 Pivots (without using or modifying them, just a simple Pivot::Create) and it took about 88mb.

     

    I rest my case.

    • Upvote 1
  12. I just added one in my scene, i've set a high range (20) and it does not flicker on my desktop pc. I sent it to my friend who has a laptop with an Intel Integrated Graphics and it flickers so it's no doubt on the hardware side (or driver).

  13. I agree, it definitely would make it easier to setup while editing but that's a matter of preference, some people need to see things visually more than others. For me, it's a matter of memory and performance, the choice was Initializing a Pivot object with tons of properties and methods vs a single Vec3. smile.png

  14. I think so. It has to do with the compiler LE is using. Anyway, do yoy (or anyone else) could tell me, how do we create now (in LE 3.5) Visual Studio Project?

    You don't need to, whenever you create a new LE project, it will create a Projects\Windows sub-folder, there's a solution for Visual Studio in there.

  15. I can't figure out on how to use the platform.lua script. The problem i'm having is with:

    Script.target = "" --entity "Target waypoint"
    

     

    I can't set a target entity from the editor, it's grayed out and i can't seem to manually set one, world:FindEntity is not working, probably due to the fact that the project is c++ and not lua.

  16. Actually Yes that's exactly why you need to use a joint, the player wont follow the platforms position otherwise. I've created a moving platform using a slider joints and the player follows the platform where ever it goes.

     

    Another thing to take into consideration using this method is to create a custom collision type for the platform that doesn't collide with the "Scene" else it can send it off course.

     

    There are these scripts in the default MyGame Project.

     

    Objects\Physics\Platform.lua

    Objects\Physics\PlatformWaypoint.lua

     

     

    I can get you the files if you can't find them.

     

    Found them in Scripts/Objects/Physics, i'll check it out later.

     

    Thanks!

  17. I managed to find a way to keep the character physics updated by sending a bogus movement and cancelling it out right after. Not sure how it would affect performance but it works perfectly.

     

    // when idling
    player_entity->model->SetInput(player_entity->rotation.y, 1, 0, 0, false, 1, 0.5, true);
    player_entity->model->SetInput(player_entity->rotation.y, 0, 0, 0, false, 1, 0.5, true);
    

  18. Thanks for the script, it does the same thing as mine when i previously tried SetPosition instead of PhysicsSetPosition. The platform movement is smoother but the character still doesn't follow it unless i keep moving on it. Seems i need to keep the character's physics updated somehow when idling and my player script is in c++ so i'm not sure how to make this work properly.

  19. I'm using a brush to make an elevator, while it goes up, it's flickering, like it's trying to drop back down, i would have thought SetGravityMode(false) would have prevented this. Is there way to eliminate this effect?

     

     

    Script.Trigger_Delay = 500;			 --int "Triggering delay"
    Script.is_active = 0;
    Script.timer = 0;
    
    function Script:Start()
    self.entity:SetMass(10000)
    self.entity:SetGravityMode(false)
    self.entity:SetCollisionType(Collision.Scene)
    end
    
    
    
    function Script:Collision(entity,position,normal,speed)
    self:Activate();
    end
    
    
    
    function Script:Activate()
    if (self.is_active == 0) then
    self.is_active = 1;
    self.timer = Time:GetCurrent() + self.Trigger_Delay;
    end
    end
    
    
    
    function Script:UpdateWorld()
    end
    
    
    
    function Script:UpdatePhysics()
    if (self.is_active == 1) then
     if (Time:GetCurrent() > self.timer) then
    	 local pos = self.entity:GetPosition(true);
    	 pos.y = pos.y + 0.1 * Time:GetSpeed();
    	 self.entity:PhysicsSetPosition(pos.x,pos.y,pos.z,0.2);
     end
    end
    end
    

    post-14340-0-92032300-1432606607_thumb.jpg

×
×
  • Create New...