Jump to content

CreateBallAndSocketJoint


Alienhead
 Share

Go to solution Solved by Josh,

Recommended Posts

I did a straight one to one copy from the docs.  But sadly, it errors out at the CreateBallAndSocketJoint command. 

I haven't tried any of the other physics commands yet. But I have no reason to believe they are working either..

local displays = GetDisplays()

-- Create a window
local window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[1], WINDOW_CENTER | WINDOW_TITLEBAR)

-- Create a framebuffer
local framebuffer = CreateFramebuffer(window)

--Create a world
local world = CreateWorld()

--Create a camera    
local camera = CreateCamera(world)
camera:SetClearColor(0.125)
camera:SetPosition(0, 0, -6)

--Create light
local light = CreateBoxLight(world)
light:SetRange(-20, 20)
light:SetRotation(35, 35, 0)
light:SetColor(3)

local parent = CreateBox(world)
parent:SetColor(0, 0, 1)

local child = CreateBox(world)
child:SetPosition(4, 0, 0)
child:SetMass(1)
child:SetColor(0, 1, 0)
child:AddForce(0, 0, 100)
child:AddTorque(100, 0, 0)

local joint = CreateBallAndSocketJoint(parent.position, parent, child)
joint:SetLimits(0, 360)

while window:Closed() == false and window:KeyDown(KEY_ESCAPE) == false do
    world:Update()
    world:Render(framebuffer)
end

 

Link to comment
Share on other sites

  • Solution

There is a typo in my declaration of this function. You can work around this temporarily by supplying a second Vec3 to the function arguments like this:
 

 

local joint = CreateBallAndSocketJoint(parent.position, Vec3(0), parent, child)

 

  • Like 1

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

Hmm okay I suppose.

Here is the very next command i tried. 

Am I correct in assuming the command IntersectsBrush() is non exist? It's a hang command in my editor.

 

    self.abox=CreateBoxBrush(world)
    self.reachpivot=CreateBoxBrush(world)
        if self.reachpivot:IntersectsBrush(self.abox) then note("hit") end

 

Link to comment
Share on other sites

I have added some commands in the API and I guess I did not update the Lua declarations to match. This is the method syntax:
IntersectsBrush(shared_ptr<Brush> brush, shared_ptr<Face> face = NULL, const float epsilon = 0.0f)

I am adding the required overloads now. NIL probably won't work for the face until I add the right syntax.

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 have replaced the function declaration with this code, which will handle all variations:

"IntersectsBrush", sol::overload(
  [](Brush& b, shared_ptr<Brush> bb, std::nullptr_t, float e) { return b.IntersectsBrush(bb, nullptr, e); },
  [](Brush& b, shared_ptr<Brush> bb, shared_ptr<Face> f, float e) { return b.IntersectsBrush(bb, f, e); },
  [](Brush& b, shared_ptr<Brush> bb, std::nullptr_t) { return b.IntersectsBrush(bb, nullptr); },
  [](Brush& b, shared_ptr<Brush> bb, shared_ptr<Face> f) { return b.IntersectsBrush(bb, f); },
  [](Brush& b, shared_ptr<Brush> bb) { return b.IntersectsBrush(bb); }
),

An update will be available tomorrow.

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

6 hours ago, Josh said:

If you are running in debug mode it should tell you more information about the error.

Ohhh trust me, I wish nothing else but other than that I was running in debug mode.

Here we can see I have the launcher json 

image.thumb.jpeg.e7b49ae7b1896613d11272d85b8e308f.jpeg

 

This shows I have the debug exe inside the directory.

image.thumb.jpeg.1bbc6b88507b768d40c719a2d65e4d09.jpeg

This demostrates the linker properly working --

image.thumb.jpeg.4fe0977c335382ae87856005ee416346.jpeg

And here is where the good times end - 

image.thumb.jpeg.3d69920ea4aa6f9e9289cd9c1a97087a.jpeg

Some things I've tried  - 

Completely removing my Firewall, reinstalling VScode, reinstalling VCRuntime's , testing debugger with Unity ( works ).

PS: Are projects bound to the documents folder? Only thing I can think of is I use an alternative directory for projects ( I try and avoid the documents folder at all costs. )

 

Link to comment
Share on other sites

You do have the Lua debugger extension installed, right?: https://marketplace.visualstudio.com/items?itemName=devCAT.lua-debug

Do you have other Lua extensions installed that might be interfering with this?

5 hours ago, Alienhead said:

PS: Are projects bound to the documents folder? Only thing I can think of is I use an alternative directory for projects ( I try and avoid the documents folder at all costs. )

Projects can be created in any folder.

This is the only mention I can find of this same error: https://stackoverflow.com/questions/76122037/how-do-i-set-up-to-run-love2d-lua-game-when-i-want-to-the-only-way-i-can-finagl

Have you tried added a variable "program"? Do the JSON settings recognize this value, or does it show a yellow curvy underline under the word "program"?

"program": "${workspaceFolder}/Controller_d.exe",

 

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

5 hours ago, Alienhead said:

This shows I have the debug exe inside the directory.

image.thumb.jpeg.1bbc6b88507b768d40c719a2d65e4d09.jpeg

Why is there no .vscode folder here?

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 do not know what those all are. You only need the file I linked to. Installing repackaged redistributables from a third party that "removes bloat" is highly suspicious.

Installing Visual Studio Community Edition 2022 is also a guaranteed way to get it installed right.

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

16 minutes ago, Josh said:

I do not know what those all are. You only need the file I linked to. Installing repackaged redistributables from a third party that "removes bloat" is highly suspicious.

Installing Visual Studio Community Edition 2022 is also a guaranteed way to get it installed right.

Okay, reinstalling VStudio Community 2022 now.

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...