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. Try including <iostream.h> in your project.

    I think thats the right header... I'm not sure...

     

    Leadwerks also has an inbuilt filesystem, have you tried using that?

    • Thanks 1
  2. Its been a while since I was tackling texture arrays & atlases.  I did manage to get the arrays working in a way, but not exactly how I wanted them too work.  As far as getting your texture to rotate, have you tried swapping dx and dy?  Is that what you mean by getting them to flip 90°?  I'm away from my PC at the moment so I'm unable to test it and I'm just going off memory.  ?

    • Thanks 2
  3. What you'll need is an Actor in C++.  The script is basically an Actor (but in LUA) that attaches to an Entity.  An Actor is a class in C++ that attaches to an Entity.

     

    Look in the Actor.h and Actor.cpp files for Leadwerks.  You derive from the Actor class like this.  I named mine cBaseActor, but you can name it anything you like.

    class cBaseActor : public Actor
    	{
    	private:
    	public:
    		cBaseActor();
    		~cBaseActor();
    
    		//reDeclare the functions found in Actor.h, create a BaseActor.cpp and define your functions there like in the script
    		void Attach();
    		virtual void UpdateWorld();
    		virtual void UpdatePhysics();
    		virtual void Collision(Entity* ent, const Vec3& position, const Vec3& normal, float speed);
    		virtual void UpdateMatrix();
    
    		virtual void PostRender(Context* context);
    }
    cBasActor* _actor = new cBaseActor();
    myEntity->SetActor(_actor);

     

  4. 4 minutes ago, wadaltmon said:

    How low are you talking? My masses are at 0.5. Perhaps setting the friction of the joint could work?

    Yeah I set mine to 0.1 but it wasn't perfect.  Lowering the friction of the kinematic joint changes how it effects the rotation and position of it's child.

  5. Quote

    ((NewtonDynamicsPhysicsDriver*)(_currentPhysicsDriver))->collisionWorld

    Thought I'd update this here too, the above code doesn't get the correct newton world.  The code below does;

    NewtonWorld* GetNewtonWorld()
    {
    	auto _world = World::GetCurrent();
    	auto _simulation = (NewtonDynamicsSimulation*)_world->simulation;
    	return _simulation->newtonworld;
    }

     

  6. Thank you!  That answer led me to finding the problem.  This is how I was getting the NewtonWorld;

    NewtonWorld* GetNewtonWorld()
    {
    	return ((NewtonDynamicsPhysicsDriver*)NewtonDynamicsPhysicsDriver::GetCurrent())->collisionWorld;
    }

    Which worked for a lot of things but it didn't match when I got the world like this;

    Model* bn = Model::Box();
    mdl->SetShape(Shape::Box());
    auto body = ((NewtonDynamicsBody*)mdl->body)->body;
    
    MainFrame::newtonWorld = NewtonBodyGetWorld(body);

    With the later the callbacks worked!

     

    Quote

    After looking through the Newton SDK I saw a couple of hooks; PreUpdate() and PostUpdate() and I was wondering at what point is the UpdatePhysics() hook called?  Is it before or after physics has been calculated / applied?

    I take it then this is a callback in UpdateWorld()?  Updating the physics when the timing is correct?

  7. So once again I am attempting to break things - @Josh I have question for you... I am using Newton functions to add a PreUpdate callback to the newton world but the callbacks are not being called unless I call NewtonUpdate myself, is World::Update() not calling NewtonUpdate?

  8. It could be that the character controller dosnt like being inside another physics shape.  You may have to find a different way to stop your held item from hitting your player.  Maybe a relative height limit?

  9. Not sure exactly but you could try calling these three lines after moving your heldObject and just before Time::Update();

    .......
    
    player->SetInput(mouseX, walk, strafe, jump);
    carryPivot->SetInput(mouseX, walk * 2, jump);
    cam->SetRotation(mouseY, 0, 0);
    
    Time::Update();

    SetInput() uses physics for controlling the character controller and shouldn't break the simulation.  I take it as your moving your mouse is still being held down?

  10. After looking through the Newton SDK I saw a couple of hooks; PreUpdate() and PostUpdate() and I was wondering at what point is the UpdatePhysics() hook called?  Is it before or after physics has been calculated / applied?

    • Confused 1
  11. 5 hours ago, TheConceptBoy said:

    Oh and from this point on, we are loading models and meshes inside the zombie actor class on Attach() right? When we detach, I believe I read somewhere that the engine handles removal of created instances automatically? Models. Sounds, Physics, Shapes? 

    The best way is to load them outside of the actor class.  Then you attach the actor to each loaded zombie entity.  If you load them in the Attach function you would have to create a separate object (maybe a pivot) and assign the actor class to that pivot so that the actor functions are called.

×
×
  • Create New...