Home › Forums › General Questions › drawing a line between two moving 3d objects?
- This topic has 4 replies, 2 voices, and was last updated 6 months, 1 week ago by kdv.
-
AuthorPosts
-
2024-06-16 at 7:47 pm #74885xeonCustomer
I have a situation where I need to draw a line between two objects. Both objects are draggable by the user and I need a line that is drawn between the two objects to stay connected.
I have tried placing html objects over each of my objects and trying to draw lines using the draw line puzzle…but thats just doesnt work well as the lines just dart off the screen.
I have tried to use the following but am having issues with erasing the previous line and updating to the new line.
Anyone have any suggestions or thoughts on whay I may be doing wrong?
let p1x = VARS[‘point1_X’];
let p1y = VARS[‘point1_Y’];
let p1z = VARS[‘point1_Z’];
let p2x = VARS[‘point2_X’];
let p2y = VARS[‘point2_Y’]
let p2z = VARS[‘point2_Z’];
let Xmdt = (p1x+p2x)/2;
let Ymdt = (p1y+p2y)/2;const material = new v3d.LineBasicMaterial({ color: 0x0000ff });
const points = [];
points.push(new v3d.Vector3(p2x, 0, p2y));
points.push(new v3d.Vector3(Xmdt, 0, Ymdt));
points.push(new v3d.Vector3(p1x, 0, p1y));const geometry = new v3d.BufferGeometry().setFromPoints(points);
const line = new v3d.Line(geometry, material);
line.geometry.attributes.position.needsUpdate = true;
app.scene.add(line);
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-06-16 at 11:17 pm #74887xeonCustomerI should clarify… this can be done using just 3D objects including a 3D object for the line. I am trying to see if a line (HTML) can be drawn between two moving 3D objects.
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-06-16 at 11:47 pm #74890kdvParticipantI need a line that is drawn between the two objects to stay connected.
smth like this https://v3d.net/a4k?
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2024-06-17 at 4:29 am #74893xeonCustomerYes.
Xeon
Route 66 Digital
Interactive Solutions - https://www.r66d.com
Tutorials - https://www.xeons3dlab.com2024-06-17 at 7:18 am #74902kdvParticipantIn your case you don’t need to draw a new line every move. Just draw the line between objects once and then update its geometry according to the objects current position.
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
-
AuthorPosts
- You must be logged in to reply to this topic.