Josh Miller

Rotate Mesh to given Point

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.