Is there a way to move the child object “B” to the world position?
There are several ways to do this. E.g.:
A.worldToLocal(Vec);
B.position.copy(Vec);
Thank you for posting the answer first.
I want B to move to world position(1,1,1), but when I run the code I gave it, it doesn’t move to (1,1,1).
Please show what you to with a live example: https://jsfiddle.net/f2Lommf5/
BTW: Please do not post screenshots of code. This is actually a no-go. Always paste the code into your post and format it by starting and ending it with three ` signs.
Thanks for the reply.
B is a child object of A.
When I do B.position.set(2,0,2)
, I want to move it to the position where C is, not the position away from A (2,0,2).
Try it like so: https://jsfiddle.net/cf6dboru/
Sorry, I had a typo in my first post. You have to use A
instead of B
when using worldToLocal()
.
Thank you!!!
Thanks for always answering