Jump to content

SpiderPig

Members
  • Posts

    2,340
  • Joined

  • Last visited

Posts posted by SpiderPig

  1. I remember trying this ages ago and that one of the functions to set height didn't work.  Have you tried SetHeight() with the last argument as true? (In C++ it's false by default)

    terrain:SetHeight(ELPOS.x,ELPOS.y, raise + 10, true)

     

  2. In C++ the syntax is this;

    void SetElevation(const int x, const int y, const float elevation, const bool update);

    Try this;

    terrain:SetElevation(ELPOS.x,ELPOS.y, raise + 10, true)

    I'm not sure why it says argument 5... there's only 4 in C++.

  3. 2 minutes ago, Argent Arts said:

    Just did another test. I double-clicked on my model in Assets to bring up the model viewer. I then went to Tools>Collapse and saved. This lost the collision hull, so I could no longer collide with my mesh in the scene, BUT I can now select it in the viewports and it turns red when selected.

    This makes me think it has something to do with the collision hull I created for in Blender.

    How are you making the collision hull?  Exporting as FBX then converting that model to a collision hull?

  4. Hi @Josh, a topic of mine for a while has been making my own character controller but with no success.  Using the default controller would be fine, except changing the worlds gravity dons't change the up vector for the controller.  It just falls to the side.

    I'd like to have the ability for each controller (and even each physics object) to have it's own gravity direction, or at the very least for the controller to work with world gravity.  Options like this allow for much more diverse range of games that Leadwerks (and Turbo) can make.  :)

     

    Test program below;

    #include "App.h"
    using namespace Leadwerks;
    
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    App::~App() { delete world; delete window; }
    
    float lookspeed = 0.1, looksmoothing = 0.5;
    Vec3 mousepos;
    
    float jointpos = 1;
    bool wireframe = false;
    Entity* child;
    Vec3 p = Vec3(0.0f);
    
    bool App::Start()
    {
    	window = Leadwerks::Window::Create();
    	context = Context::Create(window);
    
    	world = World::Create();
    	world->SetGravity(9.8f, 0, 0);
    
    	camera = Camera::Create();
    	camera->Move(0, 0, -4);
    	camera->SetDebugPhysicsMode(true);
    
    	Light* light = DirectionalLight::Create();
    	light->SetRotation(35, 35, 0);
    
    	child = Model::Box();
    	child->SetColor(1.0, 0.0, 0.0);
    	child->SetPhysicsMode(Entity::CharacterPhysics);
    	child->SetMass(1);
    
    	Model* floor = Model::Box();
    	floor->SetShape(Shape::Box());
    	floor->SetPosition(5, 0, 0);
    	floor->SetScale(30, 0.1, 30);
    	floor->SetRotation(0,0,45);
    
    	mousepos = window->GetMousePosition();
    	window->SetMousePosition(context->GetWidth() / 2, context->GetHeight() / 2);
    
    	return true;
    }
    
    bool App::Loop()
    {
    	if (window->Closed() || window->KeyDown(Key::Escape)) return false;
    	if (window->KeyHit(Key::F3) == true) { camera->GetDebugPhysicsMode() == true ? camera->SetDebugPhysicsMode(false) : camera->SetDebugPhysicsMode(true); }
    	if (window->KeyHit(Key::F4) == true) { camera->GetDebugEntityBoxesMode() == true ? camera->SetDebugEntityBoxesMode(false) : camera->SetDebugEntityBoxesMode(true); }
    	if (window->KeyHit(Key::F2) == true)
    	{
    		if (wireframe == true)
    		{
    			camera->SetDrawMode(0);
    			wireframe = false;
    		}
    		else
    		{
    			camera->SetDrawMode(2);
    			wireframe = true;
    		}
    	}
    
    	float cx = Math::Round(context->GetWidth() / 2);
    	float cy = Math::Round(context->GetHeight() / 2);
    	Vec3 mpos = window->GetMousePosition();
    	window->SetMousePosition(cx, cy);
    	mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing);
    	float dx = (mpos.x - cx) * lookspeed;
    	float dy = (mpos.y - cy) * lookspeed;
    
    	Vec3 camrot = camera->GetRotation();
    	camrot.x += dy;
    	camrot.y += dx;
    	camera->SetRotation(camrot);
    	mousepos = mpos;
    
    	float _time = Time::GetSpeed();
    	float camspeed = 0.2f * _time;
    	if (window->KeyDown(Key::Shift) == true) { camspeed = camspeed * 5.0f; }
    	if (window->KeyDown(Key::W) == true) { camera->Move(0, 0, camspeed); }
    	else if (window->KeyDown(Key::S) == true) { camera->Move(0, 0, -camspeed); }
    	if (window->KeyDown(Key::A) == true) { camera->Move(-camspeed, 0, 0); }
    	else if (window->KeyDown(Key::D) == true) { camera->Move(camspeed, 0, 0); }
    	if (window->KeyDown(Key::T) == true) { camera->Move(0, camspeed, 0); }
    	else if (window->KeyDown(Key::G) == true) { camera->Move(0, -camspeed, 0); }
    
    	Leadwerks::Time::Update();
    	world->Update();
    	world->Render();
    
    	context->Sync();
    
    	return true;
    }

     

    TestingGrounds.zip

    • Upvote 1
  5. 7 hours ago, Yue said:

    But let's face it, who cares about our assets?

     this happens, it's because our game is really famous, and in the end it would be good for you to modify it, okay?, as this system is fine, in the end I'll settle for changing the zip extension to pak, data, dll etc.

    Encrypting assets is a good idea.  If you have a purchased asset in your game, you can't just upload it unencrypted.  Even if you don't mind it being used by someone else, the person who made it probably will ;)

     

    6 hours ago, Josh said:

    Why are these so important to hide?

    It's more for convenience than anything else.  Not having to copy over extra files and folders after clicking publish would be nice :D

    • Like 1
  6. Quote

    Why are you concerned with opening wav files using the C fopen_s() command? What are you trying to do with it?

    I was using it to load binary files that had precompiled information for various parts of my game.  After adding those files into the package for publishing they couldn't load because I was using fopen_s() to load them.  (Plus the filepath was now different, being in data.zip)

     

    1 hour ago, Josh said:

    To load a zip file, the engine does this:

    
    static Package* Package::Load(const std::string& path, const std::string& password = "", const bool register = true);

    Thereafter, if the register argument was true ReadFile() will be able to read any files from the package.

    Exported zip packages created in the publish step use a different password for every single file and cannot be read from by anything except the engine, when it is loading assets. You cannot read the contents of one of these files with ReadFile(). If I gave away the secret code that generates the password, you could extract anyone's game contents.

    So a published game is loading its package with register set to false..?  Meaning I can't load my own extra files from data.zip using ReadFile() so I'll have to add those files after the publishing process as an extra folder or zip.

     

    1 hour ago, Josh said:

    If I gave away the secret code that generates the password, you could extract anyone's game contents.

    Could a feature be added where we could use our own password?  And if our own isn't specified then the default secret one is used.  This would only be useful if it were possible then to load our own files from the package using ReadFile().

  7. I'm loading a few data files in c++ and have included these files in the publishing process (below) lod, data and strc are just binary files.

    lua, mat, mdl, phy, shader, tex, ttf, wav, ogg, mpd, cfg, lod, dat, strc

    Am I correct in saying that loading with ordinary commands like fopen_s() won't be able to access the encrypted files in data.zip?

    I can think of a few workarounds, like not including those files in the data.zip and adding them manually after publishing (won't be encrypted but it's not really needed for these I guess), or maybe using the internal Leadwerks file commands?

     

    Is there a way the publisher can change or retrieve the password used for encryption?

    • Upvote 1
  8. I've got a kinematic joint to position the sliders parent, but I'm not sure how SetFriction() is meant to stop any rotation from occurring.  According to the docs I thought angular friction would be set to 0 to stop any rotation but that didn't seem to work.  I think it's because I'm using a slider and am letting gravity pull it down till it collides with the terrain.  Then as I move the sliders parent with the kinematic joint the sliders child drags and causes the parent to rotate not matter what the friction setting is.

    Can the slider be parented to the kinematic joint?  Or is this an incorrect use of the slider...?

×
×
  • Create New...