Jump to content

Character Controller Bugs


Recommended Posts

Two issues (4.5 release):

1.  I took the SetInput example code and added a jump and set the maxdecel argument to 0.01 so the character controller slides on the ground, as if on ice.  However, while you slide and press jump (letting go of the directional button), jumping slows you down and stops you, while in the air (much faster than even ground deceleration would).

2.  With acceleration/deceleration included, shouldn't the character controller slide while you try to change directions?  Right now the below code lets you change directions instantly in any other direction.  Worse, you instantly go full velocity in the new direction, even if it took a second or two to get up to full speed the original direction.

I may be doing something wrong but these seems like bugs.

#include "Leadwerks.h"

using namespace Leadwerks;

Entity* player = NULL;

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(35, 0, 0);
	camera->Move(0, 0, -8);
	Light* light = DirectionalLight::Create();
	light->SetRotation(35, 35, 0);

	//Create the ground
	Model* ground = Model::Box(10, 1, 10);
	ground->SetPosition(0, -0.5, 0);
	ground->SetColor(0.0, 1.0, 0.0);

	//Create a shape
	Shape* shape = Shape::Box(0, 0, 0, 0, 0, 0, 10, 1, 10);
	ground->SetShape(shape);
	shape->Release();

	//Create a character
	player = Pivot::Create();
	Entity* visiblecapsule = Model::Cylinder(16, player);
	visiblecapsule->SetScale(1, 2, 1);
	visiblecapsule->SetPosition(0, 1, 0);
	player->SetMass(1);
	player->SetPhysicsMode(Entity::CharacterPhysics);

	while(true)
	{
		if (window->Closed() || window->KeyDown(Key::Escape)) return false;

		Leadwerks::Time::Update();

		float move = (window->KeyDown(Key::Up) - window->KeyDown(Key::Down)) * 4;
		float strafe = (window->KeyDown(Key::Right) - window->KeyDown(Key::Left)) * 4;
		float jump = window->KeyHit(Key::Space) * 10;
		player->SetInput(0, move, strafe, jump, false, 0.05, .01);

		world->Update();
		world->Render();
		context->Sync();
	}
	return 0;
}

 

 

  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...