Ball

This function creates a new ball and socket joint.

Syntax

Parameters

Returns

Returns a new joint.

Example

#include "App.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Window* window = Window::Create();

Context* context = Context::Create(window);

World* world = World::Create();

float angle = 0;

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

Entity* parent = Model::Box();
parent->SetColor(0.0, 0.0, 1.0);

Entity* child = Model::Box();
child->SetColor(1.0, 0.0, 0.0);
child->SetShape(Shape::Box());
child->SetMass(1);
child->SetPosition(2, 0, 0);
child->AddTorque(1000, 0, 0);

auto joint = Joint::Ball(0, 0, 0, child, NULL);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Time::Update();
world->Update();
world->Render();
context->Sync();
}
}