# Line 3D Kite Game

How do I make a 3d line on a kite so that the player always has the line positioned on it?

I’m not able to position the line on the player and the kite at the same time and the line stays in the right direction with the length of the line over the distance. Is there a any 3D line extensions? I’m using a box model to make the line.

Maybe there’s another way. I don’t know about in 3D but in 2D, I would set the position to the center point between the start and end points, the angle based on angle between start and end and the width based on distance between start and end.

In 2D, I would use the following logic. IDK if it would be the same if you added the same logic to Z() for 3D

``````Set Line position x= (startX+endX) * .5 , y= (startY+endY) * .5
Set line angle to angle form start to end
Set line width to distance between start and end
``````

This takes into account positioning an object by it’s center point.

I’m not sure if I did it right but the line doesn’t appear…

I uploaded the file with the code:
https://www.mediafire.com/file/zvi8xlh3pbj34w3/Kite_Example.rar/file

Yeah, I don’t know how to handle the rotations. I haven’t used 3D much.

This is as far as I got. I changed the objects to names that I could identify.

That’s the closest I got. If I play with it later, I’ll share it.
(it calculates the center position between the 2 objects, the average. You can use divided by 2 but then there’s the slight chance of division by zero, so, I prefer times .5)

I did it exactly as shown in the photo but the line still doesn’t appear.

I uploaded another one with this code:
https://www.mediafire.com/file/nr50myqdom5ui3i/Kite_Example.rar/file

I’d love to help but I just don’t have much 3D experience.

Instead of posting your project, you’ll get a quicker response if you post a screenshot of your events. Most people probably won’t download a project and if they’re like me, I’m usually on my phone. So, I can’t open the project.

OK, thanks anyway… The events are the same as in the photo.

I changed the codes just to position the line to see how it was.

The line follows the person and the kite but is not tilted with the person holding the line to the kite.

I tried to do this but I just don’t have enough experience with 3D. I was trying to use my 2D strategy in the 3D realm, I wasn’t calculating distance and angle in the 3D world. So, it didn’t take elevation into account.

IDK if you’re still stuck but I managed to get it to work. I don’t fully understand it but ChatGPT was able to help. Along with good old trial and error. I had to add a lot of extras to see the values. The project has leftover variables and stuff. I didn’t have the willpower to optimize it. The starting position needs to be changed.

Try me, you can move the kite and the camera with the sliders.
https://games.gdevelop-app.com/game-031758c9-04dd-4ea9-9da1-211da41029dc/index.html