// Floor creation
BoxShapeSettings floor_shape_settings(Vec3(10000.0f, 1.0f, 10000.0f));
floor_shape_settings.SetEmbedded(); // A ref counted object on the stack (base class RefTarget) should be marked as such to prevent it from being freed when its reference count goes to 0.
// Create the shape
ShapeSettings::ShapeResult floor_shape_result = floor_shape_settings.Create();
ShapeRefC floor_shape = floor_shape_result.Get(); // We don't expect an error here, but you can check floor_shape_result for HasError() / GetError()
// Create the settings for the body itself. Note that here you can also set other properties like the restitution / friction.
BodyCreationSettings floor_settings(floor_shape, RVec3(0.0_r, -1.0_r, 0.0_r), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING);
// Create the actual rigid body
//Body* floor = body_interface->CreateBody(floor_settings); // Note that if we run out of bodies this can return nullptr
floor = body_interface.CreateBody(floor_settings); // Note that if we run out of bodies this can return nullptr
// Add it to the world
body_interface.AddBody(floor->GetID(), EActivation::DontActivate);
// Character creation
CapsuleShapeSettings characterShapeSettings(20.f, 5.f);
characterShapeSettings.SetEmbedded();
ShapeSettings::ShapeResult characterShapeResult = characterShapeSettings.Create();
ShapeRefC characterShape = characterShapeResult.Get();
CharacterSettings characterSettings{};
characterSettings.mFriction = 0.99f;
characterSettings.mLayer = Layers::MOVING;
characterSettings.mShape = characterShape;
m_Character = std::make_unique(&characterSettings, Vec3(0.f, 20.f, 0.f), Quat::sIdentity(), 0, physics_system.get());
m_Character->AddToPhysicsSystem();
Я ожидаю, что символ скользит только на наклонных поверхностях.
Даже если я создаю персонажа с трением 0,99, он скользит по полу. Вот код: < /p> [code]// Floor creation BoxShapeSettings floor_shape_settings(Vec3(10000.0f, 1.0f, 10000.0f)); floor_shape_settings.SetEmbedded(); // A ref counted object on the stack (base class RefTarget) should be marked as such to prevent it from being freed when its reference count goes to 0.
// Create the shape ShapeSettings::ShapeResult floor_shape_result = floor_shape_settings.Create(); ShapeRefC floor_shape = floor_shape_result.Get(); // We don't expect an error here, but you can check floor_shape_result for HasError() / GetError()
// Create the settings for the body itself. Note that here you can also set other properties like the restitution / friction. BodyCreationSettings floor_settings(floor_shape, RVec3(0.0_r, -1.0_r, 0.0_r), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING);
// Create the actual rigid body //Body* floor = body_interface->CreateBody(floor_settings); // Note that if we run out of bodies this can return nullptr floor = body_interface.CreateBody(floor_settings); // Note that if we run out of bodies this can return nullptr
// Add it to the world body_interface.AddBody(floor->GetID(), EActivation::DontActivate);