Jump to content

Physics behaviour


Recommended Posts

I have included a script that you can attach to any object (remember to set mass to 1).

 

And when you run you can move foward and turn the object using arrow keys.

 

1) First thing to notice is when moving forward, the object immediately stops when the key is released, this isnt correct, especially as in the "start" function friction and gravity is set to 0.

 

2) when rotating and you release the key, the object slows down, what is slowing the object when gravity and friction is at 0?

 

phyTest.lua

 

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

You'll get a better response if you include an example I can run. There's too many things that could go wrong if I try to reproduce your problem. The docs are great for this because you can usually copy one of the command examples and modify it to show the error.

 

I did make this example to test with:

#include "App.h"

using namespace Leadwerks;

App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}

App::~App() { delete world; delete window; }

Model* model;

bool App::Start()
{
   window = Window::Create();
   context = Context::Create(window);
   world = World::Create();
   camera = Camera::Create();
   camera->SetRotation(35,0,0);
   camera->Move(0,0,-6);
   Light* light = DirectionalLight::Create();
   light->SetRotation(35,35,0);

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

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

   //Create a model
   model = Model::Sphere();
   model->SetPosition(0,5,0);
   model->SetColor(0,0,1,1);
   model->SetMass(1);
   model->SetRotation(0,0,85);
   //model->AddForce(0,0,-200);

   //Create a shape
   shape = Shape::Sphere(0,0,0, 0,0,0, 1,1,1);
   model->SetShape(shape);
   shape->Release();

   return true;
}

bool App::Loop()
{
   if (window->Closed() || window->KeyDown(Key::Escape)) return false;

   if (window->KeyDown(Key::Right)) model->AddForce(60*Time::GetSpeed(),0,0);
   if (window->KeyDown(Key::Left)) model->AddForce(-60*Time::GetSpeed(),0,0);

   Time::Update();
   world->Update();
   world->Render();
   context->Sync();

   return true;
}

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Eh? My first post includes a script that re-creates this exact problem. Just attach the script to any object in the editor, run the project and move the arrow keys? Like I said in my original bug post.

 

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

I don't know what kind of object it is, whether it rolls or slides, so I am guessing and trying to recreate what I think you might be seeing.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I attached the script to a csg box that was on a csg ground. But as I'm sure u will see in the script I set friction to 0 and gravity to 0 yet it still stops instantly after an applied force using up arrow key which isn't right, if there's no friction and no gravity why would the object stop, and so instantly.

 

What I'm seeing is when I press up key, it adds a force to the object and it moves, when I let go of the key the object instantly stops even though friction is 0 and gravity is turned off.

 

Others are expericing what seems similer issues as you see in the thread I started in programming forum.

 

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

I did find a serious problem that I think may fix whatever you were seeing. Physics forces were being reset continually.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...