Shift vertices of circle geometry not working

Hi , i try to shift vertices of circle geometry to get just a border of circle but not working
https://threejs.org/docs/scenes/geometry-browser.html#CircleGeometry
i try to write ``` orbit.geometry.vertices.shift();

and get cannot shift of undefined 

var orbit = new THREE.Line(

            new THREE.CircleGeometry(planet.orbitRadius, 90),

            new THREE.MeshBasicMaterial({

                color: 0xffffff,

                transparent: true,

                opacity: .05,

                side: THREE.BackSide

            })

        );
1 Like

Hi!
If you need a line as a circle, use something like this:

let pts = new THREE.Path().absarc(0, 0, planet.orbitRadius, 0, Math.PI * 2).getPoints(90);
let g = new THREE.BufferGeometry().setFromPoints(pts);
let m = new THREE.LineBasicMaterial( { color: 0xffffff, transparent: true, opacity: 0.05 } );
let l = new THREE.Line(g, m);

geometry.vertices relies to THREE.Geometry that was deprecated since r125. Now, all geometries are of THREE.BufferGeometry.

1 Like

Thank you, what i want to achieve is rotation model around orbit , can i ask another question here or in a new topic ?

Depends on the question :slight_smile:
I would create a new topic with the link to this one, if needed.

Ok thank you, https://codepen.io/leen-alfalah/pen/KKWvBzO
i saw this pen and when i try to change angel to 30 like you see how i can make sphere still move around the orbit ?

and this the 90 deg https://codepen.io/leen-alfalah/pen/KKWvBzO

What angle is this? And what line of the codepen I have to look at?

i mean angle sorry , i want to move sphere around orbit
this is the codepen i try with it https://codepen.io/leen-alfalah/pen/KKWvBzO

when i try to change this part to

  orbit.rotation.x = THREE.Math.degToRad(90);

to

  orbit.rotation.x = THREE.Math.degToRad(30);

how i can make spheres still moving around orbit?

I wrote a short concept, where you can add a planet as a child to an orbit, then you can set any angle to the orbit, the planet stays on it. Also, I added an order of rotation to the planet, so you can set its inclination (if you need it)
Example: https://jsfiddle.net/prisoner849/os3Lwqa8/
Picture:

PS Hope it helps :slight_smile:

1 Like

That too much helpful thank you , great community :heart_eyes:

1 Like

Hi again, yes i need it thank you , but how can i set a rotation of the model with the direction of orbit like a flying bird?

i try like that Edit fiddle - JSFiddle - Code Playground it is right ?

Does it behave the way it should?

A little but there is some wrong movement

but the wrong movement does not appear clearly in this example because it is sphere but when i add model like bird it is appear

Something like that? https://jsfiddle.net/prisoner849/wab3o7cv/

2 Likes

You are amazing Mr, i try all way but this is the solution Thaaaaaaanxxxxx