[SOLVED] Make shape appear on sphere

https://playcanvas.com/editor/project/924001

how do I make a torus appear on the earth when I click my mouse but make it that the torus bends with the earth?

Hi @MoonAlien822! I think the tutorial project below can help you with this.

https://developer.playcanvas.com/en/tutorials/simple-shape-raycasting/

if I eventually add the ability to change the shape, will that mess it up? @Albertos also, I just noticed we have the same last name!

You will probably need to adjust the rotation of your shape according to the hit normals of the raycast.

Haha, I already saw that. Congratulations on such a beautiful last name! :partying_face:

1 Like

It worked now but I want the ball to rotate with the planet, how do I “merge” the two? (Also what’s that “merging” called? I’m trying to learn the terminology) @Albertos

nevermind I figured it out already

wait a second! @Albertos this raycast doesn’t even work! the sphere isn’t even close to the planet

Looking at your code here: https://playcanvas.com/editor/code/924001?tabs=82359022

You are using a Box shape instead of a sphere.
https://developer.playcanvas.com/api/pc.BoundingSphere.html

Also ensure that the radius you use for the sphere is correct for the size of the model.

You may want to use physics and collision picking instead for simplicity: Entity Picking | Learn PlayCanvas

How could I use collision picking for this??? @yaustar

I forked your project and changed some things to make this work.

https://playcanvas.com/project/927550/overview/worldfork

1 Like

cool! I already figured the other thing out tho, thanks anyways

1 Like

In the post below you can find an example project.