Jump to content

Rotate Mesh to given Point

Josh Miller

Recommended Posts

Hi @Josh Miller, welcome to the forum.  We were recently talking about "aiming an object" in another threadHere is one of the playground demos we talked about.

Let's do a docs search for 'rotation'... like this.

Looks like link #1 and #8 might apply... for some delicious bedtime reading.  :)

In the above playground demo, you can see a nice function @line 63 called facePoint... looks pretty handy for you.  Use at will. 

The cylinder has been created in a cone manner... no problem.  Line 28 creates the cone, line 29 tips it on its side, line 30 elongates it, and line 31 applies the red material.  You can disable cylinder position changes... by remarking-out line 137. 

Study that playground demo for a bit.  Make changes, hit RUN over and over, SAVE new versions, but bookmark their new URL's so you know how to find them later.  You can't hurt/overwrite ANYTHING important in the playground, so don't worry about pushing the wrong buttons. If you make a SAVE that you like or want to show us, paste it's URL into a comment, here.  We're interested.

If you need more help, holler.  Again, welcome aboard.

Link to comment
Share on other sites

Thank you so much for your help @Wingnut!
I respect and honor your help for such a simple question :)

I took this playground demo and removed the position part and added a sphere as a target.

Updated Demo: http://www.babylonjs-playground.com/#Z3UOX#13

It would be awesome if the red spacecraft could face this sphere which is not on the ground.
I have currently too little math knowledge for getting this done in the 3rd dimension :unsure:

Could someone help me? :D

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

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.

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.


  • Recently Browsing   0 members

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