Babylon.js icon indicating copy to clipboard operation
Babylon.js copied to clipboard

Add roation from one vector3 to another

Open BabylonJSGuide opened this issue 2 years ago • 2 comments

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.

BabylonJSGuide avatar Sep 21 '22 12:09 BabylonJSGuide

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.

azure-pipelines[bot] avatar Sep 21 '22 12:09 azure-pipelines[bot]

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

azure-pipelines[bot] avatar Sep 21 '22 13:09 azure-pipelines[bot]

@BabylonJSGuide I tried to make a PG with this but it does not work: https://playground.babylonjs.com/#QYA3JC#24

james-pre avatar Sep 22 '22 19:09 james-pre

@dr-vortex Will produce a working PG tomorrow. Will also study your PR to see if it has any advantages.

BabylonJSGuide avatar Sep 22 '22 21:09 BabylonJSGuide

Thanks!

Might I also recommend we move the rotation between vectors related stuff to #13012?

james-pre avatar Sep 22 '22 23:09 james-pre

Thanks!

Might I also recommend we move the rotation between vectors related stuff to #13012?

No for the following reasons.

  1. Each need to stand seperately on their own merits.
  2. At the moment I do not understand the way your function is used and would need to see if they were sufficient differences
  3. As I stated earlier I will study your method and get to understand it and see if it has any advantages/differences

BabylonJSGuide avatar Sep 23 '22 07:09 BabylonJSGuide

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

BabylonJSGuide avatar Sep 23 '22 09:09 BabylonJSGuide

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

BabylonJSGuide avatar Sep 23 '22 10:09 BabylonJSGuide

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

BabylonJSGuide avatar Sep 24 '22 11:09 BabylonJSGuide