Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Lethal Raptor Games

Members
  • Content Count

    1,029
  • Joined

  • Last visited

Posts posted by Lethal Raptor Games

  1. This is what I was trying to solve with resetting the hit-state.-

    Vec3 mpos = window->GetMousePosition();
    
    if (mpos.x > 500) {
    	if (window->KeyHit(Key::R) == true) {
    		int test = 0;
    	}
    }
    else {
    	//If mouse.x is less than 500 and the key is pressed nothing happens.  however if you then move your mouse to greater than 500, they key is detected as hit.
    }

    I think FlushKeys() was resetting keydown events too... I'll have to retry that and check...

  2. for (int id = 0; id < 256; id++) {
    	MainFrame::window->keyhitstate[id] = false;
    }

    I think this was the cause.  I can't remember why I was doing this though... I need to write more notes on my code...

    My only guess as to why this was the problem is that some key-presses are being picked up after a KeyHit() check is being made?

     

  3. I haven't managed to pin point this issue yet but sometimes I have to press keys multiple times before it registers.  My fps average between 40 to 60 and it happens when I use Window::KeyHit().  KeyDown() has no problems. Has anyone else had similar issues to this?  I was wondering if it was something to do with low fps and it didn't detect the key in some frames?

  4. Time::Update(const int framePerSecond=60)

    Just curious on what happens if you change the argument from 60 to something else?  Or if Sync is off and I'm getting 100 FPS and it is left at the default of 60?

  5. Quote

    This brings up a good point though, that kinematic joints probably could just use the entity position automatically when they are created.

    If setting the joints position has no effect on how it performs then that'd make sense.

  6. Quote
    • static Joint* Kinematic(float posx, float posy, float posz, Entity* entity)

    What happens if the child entity is offset from the joint position?  For example, the joint is made at 0,0,0 but the child exists at 100,100,100?  Or if I move the object with SetPosition() after I have assigned it to the joint?

  7. After seeing this code in the shaders;

    uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity;

    It makes me wonder if there is a way to get a instance index of an entity in C++?

    So after calling entity->Instance() there must be number incremented somewhere right?

  8. If I assign a material to an object in the editor then load it, it displays with the material yet GetMaterial() returns NULL.

    Screen001.thumb.png.445fffd2f85d3802985c2137d25ae481.png

     

     

     

     

     

     

     

     

     

    #include "App.h"
    
    using namespace Leadwerks;
    
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    
    App::~App() { delete world; delete window; }
    
    bool wireframe = false;
    
    bool App::Start()
    {
    	window = Window::Create();
    	context = Context::Create(window);
    
    	world = World::Create();
    
    	camera = Camera::Create();
    	camera->SetFOV(70.0f);
    	camera->Move(0, 0, -15);
    
    	auto m = Model::Load("Models\\Characters\\Generic\\generic.mdl");
    
    	//auto mat = Material::Load("Materials\\Developer\\bluegrid.mat");
    	//m->SetMaterial(mat);
    
    	auto m2 = m->GetMaterial();//returns NULL unless I load the material and apply it via code
    
    
    
    	return true;
    }
    
    bool App::Loop()
    {
    	if (window->KeyHit(Key::Escape) == true) { return false; }
    	if (window->KeyHit(Key::F3) == true) { camera->SetDebugPhysicsMode(!camera->GetDebugPhysicsMode()); }
    	if (window->KeyHit(Key::F2) == true) {
    		if (wireframe == true) {
    			camera->SetDrawMode(0);
    			wireframe = false;
    		}
    		else {
    			camera->SetDrawMode(2);
    			wireframe = true;
    		}
    	}
    
    	Time::Update();
    	world->Update();
    	world->Render();
    
    	context->Sync();
    
    	return true;
    }

    I am using the latest update on the default branch.

  9. I swear I must be doing something wrong, I can't get the following code to do anything.  The body remains active (orange) yet doesn't move.  This is using the latest 4.6 update on the default branch.

    #include "App.h"
    
    using namespace Leadwerks;
    
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    
    App::~App() { delete world; delete window; }
    
    bool wireframe = false;
    
    bool App::Start()
    {
    	window = Window::Create();
    	context = Context::Create(window);
    
    	world = World::Create();
    
    	camera = Camera::Create();
    	camera->SetFOV(70.0f);
    	camera->Move(0, 0, -15);
    
    	auto player = Model::Cylinder();
    	auto s = Shape::Cylinder();
    	player->SetShape(s);
    	player->SetMass(1.0f);
    
    	return true;
    }
    
    bool App::Loop()
    {
    	if (window->KeyHit(Key::Escape) == true) { return false; }
    	if (window->KeyHit(Key::F3) == true) { camera->SetDebugPhysicsMode(!camera->GetDebugPhysicsMode()); }
    	if (window->KeyHit(Key::F2) == true) {
    		if (wireframe == true) {
    			camera->SetDrawMode(0);
    			wireframe = false;
    		}
    		else {
    			camera->SetDrawMode(2);
    			wireframe = true;
    		}
    	}
    
    	world->Update();
    	world->Render();
    
    	context->Sync();
    
    	return true;
    }

     

  10. As a basic solution, yes.  I more referring too how to make the clothing animate with the character.  I think the only option is too export all the clothing with the character and hide / show what clothing you want.  I'm still trying to figure out if there is another way yet.

    • Like 1
  11. How would I attached a clothing model to an animated character?  The clothing has been skinned in blender and it has an animation shader applied.  I tried loading it and parenting it to the character but I am thinking it might need to be parented to the rig somehow?  Anyone have any suggestions?

  12. You're adding a force in the Z direction.  What you want is somthing like this;

    Float angle = player.rotation.y

    Float x = math.sin (angle)

    Float z = math.cos (angle)

    Addforce (position, vec3 (x, 0, z))

    • Like 1
    • Upvote 1
  13. It looks much better now.  I see you're adding 200 in the Y direction which seems too much.  You can get the facing direction of the player and add a force in that direction.

     

    • Like 1
  14. You may have to put some timing checks in place, because for a period of time the foot pivot will be inside the box and will constantly add a force.

    lastTime = 0
    function Script:Collision(entity,position,normal,speed)
    	if(Time:Millis() > lastTime + 1000) {							//Only add if the kicks are spaced by 1 second
    		entity:AddPointForce(position,Vec3(0,0,100))					//Add the force to the box
    		lastTime = Time:Millis()
    	}
    end

    Something like that.

    • Like 1
    • Upvote 1
  15. You won't need the head bone for this.

    FOOT = 10
    CRATE = 11
    
    self.footbone = self.entity:FindChild("nameoffootbone")
    self.footpivot = Pivot:create(self.footbone)
    self.footpivot:SetPosition(self.footbone:GetPosition(true),true)
    
    local shape = Shape::Sphere()
    self.footpivot:SetShape(shape)
    self:footpivot:SetCollisionType(FOOT)
    
    Collision:SetResponse(FOOT,CRATE,Collision:Trigger)
    
    ///////////////////////////////////////////////////////////
    
    function Script:Collision(entity,position,normal,speed)
    	entity:AddPointForce(position,Vec3(0,0,100))					//Add the force to the box
    end

    This is basically what I mean.

     

    EDIT : I haven't used LUA in ages so syntax will probably be off.

    • Like 2
×
×
  • Create New...