Babylon.js
Babylon.js copied to clipboard
Add roation from one vector3 to another
First commit wherever a result was returned this is now reflected in comments. Only comments changed, if current vector was returned then this was kept and and comment not changed. Ref https://forum.babylonjs.com/t/comments-refer-to-wrong-vectors-returned-by-method-using-toref/34093/3?u=johnk
An alternative way of managing an animation along a curve by calculating the rotation needed from a set rotation to a tangent. Example PGs to follow.
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Snapshot stored with reference name: refs/pull/13004/merge
Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/13004/merge/index.html
To test a playground add it to the URL, for example:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/13004/merge/index.html#WGZLGJ#4600
Links to test babylon tools with this snapshot:
https://playground.babylonjs.com/?snapshot=refs/pull/13004/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/13004/merge https://gui.babylonjs.com/?snapshot=refs/pull/13004/merge https://nme.babylonjs.com/?snapshot=refs/pull/13004/merge
To test the snapshot in the playground with a playground ID add it after the snapshot query string:
https://playground.babylonjs.com/?snapshot=refs/pull/13004/merge#BCU1XR#0
@BabylonJSGuide I tried to make a PG with this but it does not work: https://playground.babylonjs.com/#QYA3JC#24
@dr-vortex Will produce a working PG tomorrow. Will also study your PR to see if it has any advantages.
Thanks!
Might I also recommend we move the rotation between vectors related stuff to #13012?
Thanks!
Might I also recommend we move the rotation between vectors related stuff to #13012?
No for the following reasons.
- Each need to stand seperately on their own merits.
- At the moment I do not understand the way your function is used and would need to see if they were sufficient differences
- As I stated earlier I will study your method and get to understand it and see if it has any advantages/differences
Finally undertsand @dr-vortex 's method. As a mathematician when I talk about vectors I automatically think direction, whilst for his finction he his thinking position. My function finds the rotation between to direction vectors, whilst his find the rotation needed for the mesh to travel along a straight line joining two position vectors or points. Hence the confusion.
dr-vortex examples that I now follow https://playground.babylonjs.com/#QYA3JC#28, https://playground.babylonjs.com/#QYA3JC#29
@RaananW and @sebavan I will leave it up to you whether you decide whether either, both or neither are sufficiently different to what is already possible to accept the PRs.
I have made some suggests on #13012
First PG test for my method https://playground.babylonjs.com/?snapshot=refs/pull/13004/merge#S7HDGQ 2nd test for my method https://playground.babylonjs.com/?snapshot=refs/pull/13004/merge#S7HDGQ#1
1st test rotationQuaternion method https://playground.babylonjs.com/?snapshot=refs/pull/13004/merge#S7HDGQ#6 2nd test rotationQuaternion method https://playground.babylonjs.com/?snapshot=refs/pull/13004/merge#S7HDGQ#7