Jump to content

gamecreator

Members
  • Posts

    4,937
  • Joined

  • Last visited

Posts posted by gamecreator

  1. Odd, especially considering that I didn't rotate the model in either Max or via code.  How could it consider the model rotated by default?  Is this another default Max setting thing?

    Also, what's an equivalent function for global use where the rotation of the model is irrelevant?  I was trying to make a Worms-type game where I raise vertices to make hills.

  2. Seems like that would make sense.  I'm going to compare this file to another one I also created in Max that imported fine.

    Edit: you're right.  I created a custom shape a few days ago that was in meters and I swear I didn't change any settings (I don't even know where they are).  Maybe I opened another file before that and File->Reset didn't/doesn't change the scale?  Can be closed.  Sorry.

    Edit 2: anyone else that comes across this, go to Customize, Unit Setup, then System Unit Setup button to make sure you're working in the right scale.  You don't need to resize anything, changing that setting seems to export correctly afterwards.

  3. I exported the attached FBX from Max.  On importing into the editor, it gets shrunk down greatly.

    The attached FBX is simply a right triangle which I created with vertices at 0,0,0 0,1,1 and 0,1,0.  If you open the FBX with a text editor you see the points represented like so

    Quote

            Vertices: *9 {
                a: -0.5,-0.5,0,0.5,-0.5,0,0.5,0.5,0

    I don't know why it's off by 0.5 but whatever; the triangle is 1 wide and 1 high, just as I created it in Max.  However, when I import it into the Editor and then run the code at the bottom of this post, it prints the following:

    Quote

    vertex 0: 0.010000, -0.000000, 0.000000
    vertex 1: 0.010000, 0.010000, 0.000000
    vertex 2: 0.000000, -0.000000, 0.000000

    Any idea why?  Seems like Leadwerks shrinks it to 1/100th of its size for some reason (you can't even see it in the Editor Model Viewer (which I guess could be another bug report since the Viewer doesn't zoom in properly)).

    #include "Leadwerks.h"
    
    using namespace Leadwerks;
    
    Model* model;
    
    
    int main(int argc, const char *argv[])
    {
    	Leadwerks::Window* window = Leadwerks::Window::Create();
    	Context* context = Context::Create(window);
    	World* world = World::Create();
    
    	Camera* camera = Camera::Create();
        camera->SetRotation(15, 0, 0);
        camera->Move(0, 0, -0.3);
    
    	Light* light = DirectionalLight::Create();
    	light->SetRotation(35, 35, 0);
    
    	model = Model::Load("Models/triangle.mdl");
    
    	while (true)
    	{
    		if(window->Closed() || window->KeyDown(Key::Escape)) return false;
    
    		if(window->KeyHit(Key::Enter))
    		{
    			//  Print vertex coordinates
    			for(int i=0; i<((Model *)model->GetChild(0))->GetSurface(0)->CountVertices(); i++)
    			{
    				Vec3 vp=((Model *)model->GetChild(0))->GetSurface(0)->GetVertexPosition(i);
    				printf("vertex %d: %f, %f, %f\n",i,vp.x,vp.y,vp.z);
    			}
    		}
    
    		Leadwerks::Time::Update();
    		world->Update();
    		world->Render();
    		context->Sync();
    	}
        return 0;
    }


     

    triangle.FBX

  4. 2 hours ago, havenphillip said:

    What's the one you were talking about earlier that comes with Leadwerks but doesn't look very good?

    Just the one that Leadwerks activates when you add water to a scene.  If you move the camera underwater, there is no blue/swaying effect at all.

    By the way, shadmar uploaded a version to dropbox some months after that discussion Thirsty Panther linked.  The post is here: https://www.leadwerks.com/community/topic/10334-day-and-night-cycle-shader/?do=findComment&amp;comment=106706
    I believe that's the latest version but someone let me know if that's not the case.

     

    • Like 1
  5. It's a post effect you can attach to your scene or active by code.  Fair warning that the one that comes with Leadwerks doesn't (or didn't) have an underwater effect so it looks bad when you're underwater.  You can find one I think on the workshop or on the forums from shadmar that includes that too.

  6. Thank you for the suggestion Ma-Shell.  The copy trick from an entity ended up working:

    Model *temp=NULL;
    temp=(Model *)Model::Load("Models/level/ground.mdl");
    groundmodel=(Model *)temp->Copy(true);
    temp->Release();

    It's weird to need to do this and hopefully Josh or someone else can also chime in on this but I guess I got my workaround for now.

  7. My understanding of the function was that it would load a single model as a copy instead of an instance, so you could modify just that copy.  It makes no sense to me for it to load 2 copies into the groundmodel variable and that I then can't even interact with the first one (if I do groundmodel->Move, for example, it only moves the second loaded model).  If you do this multiple times, you'll have twice as many models as you need.  And this still doesn't explain why Release doesn't release both of them.  The number of entities keeps going up, every time I run that function, even though it should in theory clear both.

    Edit: I'll try to see what happens if I do an entity copy instead of an entity load.  Thanks for the suggestion.

  8. I'm trying to load a model as a copy instead of the default instance but for some reason it loads in twice.

    	if(groundmodel!=NULL)
    	{
    		groundmodel->Release();
    		groundmodel=NULL;
    	}
    
    	printf("entities before: %d\n",world->CountEntities());
    	groundmodel=(Model *)Model::Load("Models/level/ground.mdl")->Copy(true);
    //	groundmodel=(Model *)Model::Load("Models/level/ground.mdl");
    	printf("entities after: %d\n",world->CountEntities());

    However, if I comment out the Copy line and uncomment the one below it (instance load), it works as expected.  Is this a bug or am I doing something wrong?

  9. I don't know your specifics but recently I had a crash when I loaded a different model in my game.  The issue ended up being that I was trying to manipulate an attachment via code that the new model didn't have.  In other words, make sure you're not trying to access a model (like a gun) that your new models may not have.  Just a thought; could be anything though.

  10. Pretty much.  You can have the client send an ID # you made up as the very first packet after they connect.  If the host receives this number, it accepts the client into the game.  Otherwise, it doesn't let them play.  They'll still be in the lobby (I don't think a host can remove a client from a lobby) but you treat them as if they're not.

×
×
  • Create New...