Jump to content

Crane Game


p3p3k
 Share

Recommended Posts

Hello guys, i want to make Crane Game where i can move object with hook. Can anyone explain me ho to grab object with hook and move with it?  I  have  collisions  but i don´t know how move two object together  and repeat it with other objects 

Link to comment
Share on other sites

How do I set the correct position and rotation when I unparent the lifted box from the crane hook? (mesh2.parent = null)

If someone knows for rotationQuaternion as well, that would be even more great. :-)

Would be useful to know for my Model Train Simulator game cranes:

babylonjsmodeltrainsimulatorcrane.jpg.f45c1cd4df4882627bed90f11715f29c.jpg

^ a low-poly crane to lift goods from wagons

Link to comment
Share on other sites

6 hours ago, QuintusHegie said:

How do I set the correct position and rotation when I unparent the lifted box from the crane hook? (mesh2.parent = null)

This is what you are after:

mesh2.setParent(null);

That will unparent the mesh, while maintaining rotation and position in world co-ordinates (instead of local to the parent).  If it doesn't work just post a PG.  I've got lots of similar versions of it in my game :)  If you have physics on your crane cargo this is where you would call .wakeUp(), too (ie: get crane cargo to fall). Cheers.

Link to comment
Share on other sites

Yeah!  Physics ropes.  :)  https://playground.babylonjs.com/#1KPF49#53

Sort of.

We would get SO many angry calls... from shipping clients who received damaged crates/cargo.  :)

What fun is allowSleep() on a physics impostor?  Keep that puppy moving, ready to tip-over a crane or smash a rail yard flatbed truck... FUN!

But, Garden Trains looks a bit "Fisher Price"... perhaps not wanting too much death and destruction.

Link to comment
Share on other sites

18 hours ago, p3p3k said:

Wow, looking very good. Do you have your game online or do you have on github? I'd like to draw some code from your solution if i can of course ?

What type of crane(s) do you want to make in your game? What do they have to do? What is the aim of your game? etc. (Need a bit more info then just 'a crane game'.)

Then I can look up some of my code and see what's useful. In my game there are different types of cranes that operate differently.

11 hours ago, brianzinn said:

This is what you are after:


mesh2.setParent(null);

That will unparent the mesh, while maintaining rotation and position in world co-ordinates (instead of local to the parent).  If it doesn't work just post a PG.  I've got lots of similar versions of it in my game :)  If you have physics on your crane cargo this is where you would call .wakeUp(), too (ie: get crane cargo to fall). Cheers.

Thanks. I'll use Mesh.setParent(obj). Didn't know about that. Until now I used mesh.parent = null... good to know there a proper function for it ?

7 hours ago, Wingnut said:

Yeah!  Physics ropes.  :)  https://playground.babylonjs.com/#1KPF49#53

Sort of.

We would get SO many angry calls... from shipping clients who received damaged crates/cargo.  :)

What fun is allowSleep() on a physics impostor?  Keep that puppy moving, ready to tip-over a crane or smash a rail yard flatbed truck... FUN!

But, Garden Trains looks a bit "Fisher Price"... perhaps not wanting too much death and destruction.

Hehe. The more angry calls the better ?

No blood in my game indeed but that doesn't mean there will be no action. In contrary! The nice thing about virtual toys is that broken ones will be repaired again in a snap.

I've recently learned the computer AI opponent to use the weaponry (cannons etc.) that you helped me with earlier, Wingnut.

Q

Link to comment
Share on other sites

23 hours ago, QuintusHegie said:

What type of crane(s) do you want to make in your game? What do they have to do? What is the aim of your game? etc. (Need a bit more info then just 'a crane game'.)

Then I can look up some of my code and see what's useful. In my game there are different types of cranes that operate differently.

Thanks. I'll use Mesh.setParent(obj). Didn't know about that. Until now I used mesh.parent = null... good to know there a proper function for it ?

Hehe. The more angry calls the better ?

No blood in my game indeed but that doesn't mean there will be no action. In contrary! The nice thing about virtual toys is that broken ones will be repaired again in a snap.

I've recently learned the computer AI opponent to use the weaponry (cannons etc.) that you helped me with earlier, Wingnut.

Q

I want simply crane game, where i will have 5 levels and there i´ll transfer boxes to colored place. 

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...