Jump to content

SpiderPig

Members
  • Posts

    2,412
  • Joined

  • Last visited

Posts posted by SpiderPig

  1. You could;

    Create pivot.

    Parent pivot to the foot bone.

    Create Box shape for the pivot.

    Enable collisions between the box and pivot as Trigger.

    In the scripts Collision() function -> Get the box entity and AddPointForce() at the collision position.

    • Like 1
  2. What I have at the moment is the terrain triangles surrounding the player are created from a polymesh (in red).  If I set the collision between the terrain shape and the player shape to collide it calls the Collison() callback, but if I set it too trigger it falls straight through without triggering it.  The box (in green) is also a trigger an it works flawlessly.

    Does a trigger shape need to be a volume rather than a group of thin polys?

    PhysicsScreenshot.thumb.png.ce8464499511b0d2c2b55119889db48d.png

     

    A bit of info on what I'm doing;

    I am applying a force to the player's shape to simulate gravity, when a collision on the terrain is detected it stops the velocity and keeps the entity at that position until moved by the player.  To find the position the player should move too, I get the collision normal, create a plane, and find a position on that plane a little further forward (or backward) then use PhysicSetPosition() to move it there.  The problem with the collision set to collide is the player drags across the surface and causes jittering.  I need to be able to detect the collision without the physics system actually doing anything.  I.e. A trigger.

  3. How would I transform the following (or any other) vector to a 3D rotation without using a pivot as a buffer?  Can the Transform functions be used here or have I already found the easiest way?  Calling on any math guys out there... ;)

    upDirection = Vec3(0.0f, 1.0f, 0.0f);
    pivotAlignment->AlignToVector(upDirection, 1);
    Vec3 _rot = pivotAlignment->GetRotation();			//_rot = Vec3(0.0f, 0.0f, 0.0f);
    physicsParent->PhysicsSetRotation(_rot, 1.0f);

    I don't want to use a pivot because, well, it just seems ugly.

  4. I solved the jittering of the physics object, it was simple.  I was setting the cameras pivot to the heads position each frame instead of parenting it to the head bone (doing that caused the camera to rotate with the bone - which was kinda what I wanted except the bone had weird rotations on top of how it was animated)

    auto _headPos = frameManager->GetBonePosition(bones.head, true);
    cameraPivot->SetPosition(_headPos, true);

    So I just parented the camera's pivot the player entity instead.  Problem-o solved.

    problem-solved.jpg.a73a7d3fb52c730839afe7bf573de273.jpg

    • Haha 1
  5. I'll reduce the poly count and see how that helps then.

    Quote

    The number of batches is probably the bottleneck here.

    Is a batch a group of entities that fall within the frustum?

    Quote

    New engine is very very good at handling those.

    You tease me - I'm thinking about moving over to Turbo now but am worried there might not be enough features yet to make the transition seamless.  Like I know there is no 2D drawing yet... and some commands are missing...

  6. After a bit of testing I think the low FPS is due to multiple things.  1 to 2 million triangles and up to 300 - 400 batches. There is also an algorithm that runs every so often and can eat up to 10ms which drops the frame rate quickly (I think this sudden drop is causing the jerking movements). The physics shape I'm using is 360 polys - too much?

    #canwaitforturbo

  7. Not sure if I'm using these right - is GetObjectA() the correct one to use?

    auto _interaction = new Interaction();
    entity->SetObject("interaction", (Object*)_interaction);
    auto test = entity->GetObjectA("interaction");//retuns NULL

    I've been using SetUserData() previously but I need more than one object assigned to an entity.

  8. Is there a minimum FPS a game should run at to have smooth physics?   Mine is hitting 40 to 50 FPS at the moment and physics is very jumpy.  It is even worse in debug mode when fps gets as low as 10.  It's not just lag between frames - physics actually goes haywire.  I'm wondering if it is a result of low FPS or somthing else in my code.

  9. auto _currentWorld = World::GetCurrent();
    world = World::Create();
    
    auto b = Model::Box();
    b->SetColor(1, 0, 0, 1);
    
    World::SetCurrent(_currentWorld);
    
    worldBuffer = Buffer::Create(512, 512);

    I'm trying to create a second world where I can render an object in and then draw that render on screen.  But so far I can't get the second world to show anything, can anyone see anything wrong with my code?

    Texture* cInventory::_renderWorldBuffer()
    {
    	auto _currentBuffer = Buffer::GetCurrent();
    	worldBuffer->Enable();
    
    	//World::GetCurrent()->Render(); <- This works
    	world->Render();		//This is not
    
    	_currentBuffer->Enable();
    
    	return worldBuffer->GetColorTexture();
    }

     

×
×
  • Create New...