Jump to content

Set mesh rotation depending on 2 position vectors


XTender
 Share

Recommended Posts

I try something pretty easy (I think) but I cant make it work.

The want that the faces are aligned in their direction between two world space Vector3.

The position on the screenshot is not correct but that's not the problem. :) 

I tried it with lookAt for the mesh and also played a bit around with RotationFromAxis from this example

http://www.babylonjs-playground.com/#1QM99D#6

But its always not correct rotated, correct would it be when they are aligned along the edge between the two vertices where currently the feces are placed.

Any suggestions?

Bildschirmfoto 2017-11-19 um 14.26.47.png

Link to comment
Share on other sites

:)  Hi guys. 

This issue is related-to the old cylinderBetweenPoints() function that is laying around in some playgrounds.  Xtender wants the fence-section to start at END of previous fence-section run, and go to some "next fence-section start position".  He is having a difficult time determining the Y-rotation needed to accomplish that.  (not uncommon)

He needs fenceSectionBetweenPoints()  :)  Each fence section might need a gizmo/invisible-parent... as a central rotating/positioning device.  It also might be wise to set the fence-section pivotPoint/origin... to the start-point (left-edge?) of the fence-section.  Not sure... still thinking.  :)

A playground search for 'vend' will find all those playgrounds.  One of them is here:  https://www.babylonjs-playground.com/#1MQTOG#0

Hope this helps (and clarifies).

Link to comment
Share on other sites

Nice. 

I had a purrrdy, fancy, fence thing going... but... too artsy... couldn't beat Adam to the draw.  Mine wasn't going to use picked points... just an array of fence post points. 

If each fence section has a set width (and it does), then... hmm.  Needs thinkin'.  I want to make an irregular-shaped circle of fencing, just to experiment.  Adam will beat me to that, too... but I always learn stuff from his code.  (He's a friggin' genius.  So is Jerome.  I am among BIG guns, here.)  :) Anyway, so far...

https://www.babylonjs-playground.com/#1QM99D#17

Too slow. Not finished.  :)  Darned Adam... he's got a FAST draw.  No outlaw challenge can gun him down in the streets.  heh

Later, we'll attach 2 physics hingeJoints between each fence section in the "circle", and create the first BJS physics-active bulldozer track.  :/

Link to comment
Share on other sites

Hi XT.  Oh sure, now we have MORE hell.  :D  (Wingnut trying comedy, there, XT... ignore at-will)

Let me predict:  You want all vertical fence-boards... to remain perfectly vertical, even when section is running up/down a hill?  Cross-boards can be angled up/down, but not verticals?  Thoughts?

Link to comment
Share on other sites

Just ignore that the are fences. Imagen that they are just 3d "Lines" and I would like to place it between 2 V3 . The Position and Scaling is the easy part. its just the rotation thing.

But I thing I come a bit closer, looks like my artist mad some failures in the model export. when i make the mesh lookAt the targer position its nearly perfect. only that its pointing in the complete opposite direction.

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