Jump to content

How to solve leverage (physics)? - Playground


ian
 Share

Recommended Posts

Hi,

can anybody teach us or help resolve Levrage?

How should I resolve that horizontal green bar will rotate around his origin point (origin point is in center of green bar) and push tile on the other side?

So that ball push green bar on his side and than bar should push Tile on the other side.

Can anybody complete code in playground and teach us how to do this?

I decide to prepare more playgrounds (simple models) like tutorials for learning.

Here is plaground http://www.babylonjs-playground.com/#1UF7BM#14

I'm not such good in physics but I really would like to learn new  things.

greetings

Ian

Link to comment
Share on other sites

Thanx adam, my problem. OK fix that.
http://www.babylonjs-playground.com/#1UF7BM#16

Now. How can I tell in playground that horizontal bar should rotate around his center of horizontal bar ( origion => in center of horizontal bar above horizontal bar )?

How can I get origin poin (x,y,z) of horizontal bar? Should I lock z, how can I do that? Or is there any other solution to achive that.

Link to comment
Share on other sites

OK, very bad docomented. No example. No explanation.
 

What is connectedPivot what is mainPivot?

should we do

barVertical.physicsImpostor.addJoint( barHorizontal, hingeJoint1 );

or

barHorizontal.physicsImpostor.addJoint( barVertical, hingeJoint1 );

 

OK

----------------------------------------

(for case: barVertical.physicsImpostor.add( barHorizontal, hingeJoint1 )

main is barVertical , connected is barHorizontal
the mainPivot is local (0,0,0) of barVertical (or origin of barVertical if origion is not in center of barVertical )

the connectedPivot is local (0,0,0) of barHorizontal (or origion of barHorizontal )

the mainAxis is axis around which connectedObject (barHorizontal) will rotate. For example if mainAxis is (1,0,0) than barHorizontal will rotate around x-axis

 

what is

var mainPivot = barVertical.position; or is mainPivot=barHorizontal.position ???
var connectedPivot = barHorizontal.position; or is connectedPivot=  barVertical.position ???
var hingeJoint1  = new BABYLON.HingeJoint({  connectedPivot, mainPivot  }); ???

I try some combination still don't know.

Can anybody explain things a little bit?

Or fix upper playground and save and explain with comments.


greetings

Ian

 

 

Link to comment
Share on other sites

Hi @ian.  I just "pinged" you, if you have notifications turned ON in the forum.  :)

Just use the '@' follow by a single character, and then a panel SHOULD open.  Keep typing more characters of the person's name, and soon, you will see the person's name in that panel.  Choose it, and you have put a "person tag" into your post.  For example @Deltakosh pinged @RaananW two posts above... so Raanan will visit if/when he has available time to read forum and help users.  I just pinged both of them.  :)

Meantime, you can get lesser-quality help from 4th-string helpers like me.  It's lousy help, but at least we are communicating.

Raanan once helped me get a beginner "train wheel simulator" scene working... after the physics plugin refactoring of last year.  I think it will help you with axles/pivots.

http://www.babylonjs-playground.com/#1ND6TH#5

I have been working-on YOUR test scene, too, mostly trying to find-out WHY the tile is not falling onto the top of the floor-box.  It sinks-in a small amount.  Not sure why.  Still testing... slowly.

http://www.babylonjs-playground.com/#1UF7BM#2

Sorry the help is so slow arriving.  Physics engines are not really part of BJS, but still we must try to improve the interface and docs for the interface to them. 

Same with exporters... not really part of BJS, but yes, it still is part of it.  "Connections" to physics engines and modeling software... are heavily-used and very important... but they are also difficult work. 

I worry that our two best physics people... rarely visit.  Did we over-workload them with too many questions/problems about physics?  Did they lose fun/happiness?  I hope not.  Meantime, we need more experts, you think?  I think so. 

Meantime, our friends/users lose confidence and happiness in BJS... with each physics and importer/exporter failure.  And they are unhappy when they can't find help/helpers.

I prefer that our friends be happy and speak well of BJS.  But keep in mind... the helpers are all volunteers and have RL issues to deal-with... perhaps LOTS of them.  Living on Earth is not always easy.  :)  In fact, it rarely is.  heh.  I am here to TRY to help.

Link to comment
Share on other sites

qul qul.
I know people works also other things, and that they are bussy. But I'll wait and try diffrent things to try to solve. Meybe it is very good to prepare some simple playgrounds with physics and try to solve it. And I thing it should be good for babylon and people who would like to use babylon. 
Soon I'll try to prepare some more playgournd for playing around physics things and try to solve it like show case. 
OK thank you to know me how to ping others on this forum. 
(I also post message to RananW, but I know that he is bussy as all we are. So take the time. Meantime I have to try/do/experiment also other thnik (animations,physics,export babylon,instances..). 

Maybe tile is not OK because it should be more up (on y axis I think in babylon (but on Z axis on blender)).

So I think animations and physics are one of the most beautiful things in engines. :)

By the way this is not topic of this subject, but anyway, If blender exporter will be able to deal with Blenders Groups, then this will be one of awesome thins for babylon. But ok, for know instances are QUL enought for a meantime.
What I would also like to achive is, I would like to build one component in blender and I would like to also grant/assign this component diffrenet colliders. So I would like at first crate component and than create instances from this component, BUT I would also like to add this component colliders(Box,Spere,Capsula..). So that component will be ready for creating instances with its colliders. I don't want to build colliders on final model, I would like to add collider on component and each component sould have his own colliders. So that when I will build scena from different components, final model should have all colliders in (instances of components).

So how do you suggest to do that how to  approach to solve this problem (with Blender and Babylon). Any suggestions/tips/hints?

 

greetings

Ian

Link to comment
Share on other sites

Ahh, you would like colliders installed on all 'master mesh', so when you create instances from them, the instances have colliders?  Yeah, cool idea.  Perhaps build your own createInstance wrapper function. 

Ian's Custom Instance Shop  :)

"Physics-fortified meshes... for your impulsing pleasure!"

I hope I am on-topic.  Just now, I thought about old time war... with cannons.  Lots of cannons... and entire battlefield... and all the cannonballs... need physics.  So, need a custom instantiateCannonball()... create cannonballs exactly how you want them created... collider installed, physics params all set... ready to fire (impulse).  :)

6 hours ago, ian said:

So I think animations and physics are one of the most beautiful things in engines.

I agree 100%.  Godrays (volumetric light scattering) is beautiful, too.  Animated godrays even better!  :)

Link to comment
Share on other sites

Ok, the "only" think I see for now is maybe to create instances add them primitive colliders and use paren-child to cobine component. But if I could use group instant of parent-child it would be much better I think.

Quote

I hope I am on-topic.  Just now, I thought about old time war... with cannons.  Lots of cannons... and entire battlefield... and all the cannonballs... need physics.  So, need a custom instantiateCannonball()... create cannonballs exactly how you want them created... collider installed, physics params all set... ready to fire (impulse).  :)

I don't understand what you men. (I would prefer add colliders in blender (on compontets) than add them in babylon code.
 

Link to comment
Share on other sites

Hi Ian,

Yep, the documentation is ... lacking, I agree. Especially as the one who wrote it. I also promise getting into fixing and expanding it, when I have the time.

Having said that - we are all developers here, and the project is open source. So jumping into code might have helped. There are also so many demos for hinge joints floating around, like the car or wingy's train wheel demo.

Now - yes, you will need a joint. A HingeJoint as adam suggested (as this is a hinge :) ) here is a quick hinge demo using cannon - http://www.babylonjs-playground.com/#IBGBX#2

Link to comment
Share on other sites

Blue tile is Just a tile which horizontal bar should push It to fall down. Blue tile position shold be more Up (Babylon Up is y I think) this y Up must I fix in blender. 

Forget blue tile. The main problem is how to Set parameter pivota of vertical an horizontal bar and hinge between this two bars. Ball Just push horizontal bar but horizontal bar should Not fall down. Like your First playground. :)

Your First playground is similar what I would like to achive.

Link to comment
Share on other sites

On 9/5/2016 at 11:41 AM, RaananW said:

Hi Ian,

Yep, the documentation is ... lacking, I agree. Especially as the one who wrote it. I also promise getting into fixing and expanding it, when I have the time.

Having said that - we are all developers here, and the project is open source. So jumping into code might have helped. There are also so many demos for hinge joints floating around, like the car or wingy's train wheel demo.

Now - yes, you will need a joint. A HingeJoint as adam suggested (as this is a hinge :) ) here is a quick hinge demo using cannon - http://www.babylonjs-playground.com/#IBGBX#2

I just add material, so that people(we) know which object is which (so red and green).
http://www.babylonjs-playground.com/#IBGBX#4

Link to comment
Share on other sites

I'll try to fix it.

"Can you fix it and send .babylon file that I put it on the my dropbox for playground."

But the main problem here is how to setup hinge joint between two bars. Horizontal bar should rotate around pivot on top of vertical bar, ONLY WHEN the ball push it. Horizontal bar should not fall down!!
I'll try to fix that tile will not fall through floor. I don't know yet what is there a problem with tile. It should not fall through floor.

Link to comment
Share on other sites

I understand.  Pivot issue is solved, right? 

The tile-below-floor problem... perhaps not your fault.  I think the physics engine has problem.  Maybe tile scaling.  Not sure. 

No need to do work, Ian.  Work sucks.  :)   I only want to understand WHY it is doing that. 

Was a "collider" put on it... in Blender?  Mesh arrived at BJS... with Blender collider installed? 

I have zero experience with that.  Thx for info and teaching.

Link to comment
Share on other sites

Ok again (new model). I split flor left (mesh collider) and right box collider. And now tile is ok. But now will someone ask me why is Ball stuck. (because of physics) It should not stuck. 

I add floor thickness.


But the main problem is to setup bars with physics. 
http://www.babylonjs-playground.com/#1UF7BM#19

Link to comment
Share on other sites

52 minutes ago, Wingnut said:

I understand.  Pivot issue is solved, right? 

The tile-below-floor problem... perhaps not your fault.  I think the physics engine has problem.  Maybe tile scaling.  Not sure. 

No need to do work, Ian.  Work sucks.  :)   I only want to understand WHY it is doing that. 

Was a "collider" put on it... in Blender?  Mesh arrived at BJS... with Blender collider installed? 

I have zero experience with that.  Thx for info and teaching.

No pivot is not solved. No I did not add collider in blender (just here in code). What is going on with previous version Tile and plane. I don't know why tile fall through (maybe tail's origin was not in center of tile and therefore box collider was shifted with tail) .
 

Link to comment
Share on other sites

Yep, but it is apparently not enough :)

Look @ian , we are always happy to help! really, but you don't show us where you fail. you just show us a scene and present a question. We all showed you how to, but you never should us what really IS wrong.

So, here - http://www.babylonjs-playground.com/#1UF7BM#5 . This is working. and this was generally copied from a different example and modified to fit your needs. 

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