p3p3k Posted November 28, 2018 Share Posted November 28, 2018 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 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 28, 2018 Share Posted November 28, 2018 You can link one mesh to another with mesh2.parent = mesh1; Mesh 2 (child) will follow mesh 1 which is the parent. Sebavan 1 Quote Link to comment Share on other sites More sharing options...
p3p3k Posted November 29, 2018 Author Share Posted November 29, 2018 20 hours ago, Dad72 said: You can link one mesh to another with mesh2.parent = mesh1; Mesh 2 (child) will follow mesh 1 which is the parent. Great, thank you Quote Link to comment Share on other sites More sharing options...
QuintusHegie Posted November 29, 2018 Share Posted November 29, 2018 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: ^ a low-poly crane to lift goods from wagons Quote Link to comment Share on other sites More sharing options...
p3p3k Posted November 29, 2018 Author Share Posted November 29, 2018 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 :-) Quote Link to comment Share on other sites More sharing options...
brianzinn Posted November 30, 2018 Share Posted November 30, 2018 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. Sebavan and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 30, 2018 Share Posted November 30, 2018 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. Quote Link to comment Share on other sites More sharing options...
QuintusHegie Posted November 30, 2018 Share Posted November 30, 2018 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 Sebavan and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
p3p3k Posted December 1, 2018 Author Share Posted December 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.